From: Ian Jackson Date: Sun, 29 Jul 2018 03:51:02 +0000 (+0100) Subject: Remove // from inside conditionals X-Git-Tag: archive/debian/6.2~12 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=3028f34f1868b3726f856ede688437b5279c2b05;hp=f7559bb3b9d43f6ac272841f9bcd2620db51b7f2 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 --- diff --git a/debian/changelog b/debian/changelog index 8e87d39f..a01f5dfb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ dgit (6.2~) unstable; urgency=medium - * + * dgit: Minor code cleanup. -- diff --git a/dgit b/dgit index 6e8b757e..63126712 100755 --- a/dgit +++ b/dgit @@ -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 f0022252..07e5f478 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) {