diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-07-29 04:51:02 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-07-29 05:02:21 +0100 |
commit | 3028f34f1868b3726f856ede688437b5279c2b05 (patch) | |
tree | 8d8d5644820159a24753e8891c18259ab0f74bc2 | |
parent | f7559bb3b9d43f6ac272841f9bcd2620db51b7f2 (diff) |
Remove // from inside conditionals
This idiom is terse, but quite confusing. Instead, handle the undef
case explicitly.
While we are editing these:
* Change two internal errors from die to confess
* Fix a die in git-debrebase which ought to be badusage
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rw-r--r-- | debian/changelog | 2 | ||||
-rwxr-xr-x | dgit | 10 | ||||
-rwxr-xr-x | git-debrebase | 3 |
3 files changed, 9 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog index 8e87d39..a01f5df 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ dgit (6.2~) unstable; urgency=medium - * + * dgit: Minor code cleanup. -- @@ -824,7 +824,8 @@ sub access_forpush () { } sub pushing () { - die "$access_forpush ?" if ($access_forpush // 1) ne 1; + confess 'internal error '.Dumper($access_forpush)," ?" if + defined $access_forpush and !$access_forpush; badcfg "pushing but distro is configured readonly" if access_forpush_config() eq '0'; $access_forpush = 1; @@ -4439,7 +4440,8 @@ END responder_send_command("param isuite $isuite"); responder_send_command("param tagformat $tagformat"); if (defined $maintviewhead) { - die unless ($protovsn//4) >= 4; + confess "internal error (protovsn=$protovsn)" + if defined $protovsn and $protovsn < 4; responder_send_command("param maint-view $maintviewhead"); } @@ -7049,8 +7051,8 @@ sub check_env_sanity () { foreach my $name (qw(PIPE CHLD)) { my $signame = "SIG$name"; my $signum = eval "POSIX::$signame" // die; - ($SIG{$name} // 'DEFAULT') eq 'DEFAULT' or - die "$signame is set to something other than SIG_DFL\n"; + die "$signame is set to something other than SIG_DFL\n" + if defined $SIG{$name} and $SIG{$name} ne 'DEFAULT'; $blocked->ismember($signum) and die "$signame is blocked\n"; } diff --git a/git-debrebase b/git-debrebase index f002225..07e5f47 100755 --- a/git-debrebase +++ b/git-debrebase @@ -970,7 +970,8 @@ sub defaultcmd_rebase () { } sub cmd_analyse () { - die if ($ARGV[0]//'') =~ m/^-/; + badusage "analyse does not support any options" + if @ARGV and $ARGV[0] =~ m/^-/; badusage "too many arguments to analyse" if @ARGV>1; my ($old) = @ARGV; if (defined $old) { |