From: Ian Jackson Date: Thu, 5 Jan 2017 17:40:45 +0000 (+0000) Subject: badcommit-fixup: reorganise arg parsing X-Git-Tag: archive/debian/2.16~24^2~6 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=270c257f81665d1bcfab1ca4a3d831b5bcabc034;ds=sidebyside badcommit-fixup: reorganise arg parsing --- diff --git a/badcommit-fixup b/badcommit-fixup index b8cb88ad..ca2e0dfb 100755 --- a/badcommit-fixup +++ b/badcommit-fixup @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # usage: -# .../badcommit-fixup --test +# .../badcommit-fixup [-- --test # .../badcommit-fixup --real use strict; @@ -10,10 +10,19 @@ use POSIX; use IPC::Open2; use Data::Dumper; -die unless "@ARGV" eq "--test" or "@ARGV" eq "--real"; +my $real; -my ($modeopt) = @ARGV; -my $real = ($modeopt eq '--real'); +foreach my $a (@ARGV) { + if ($a eq '--test') { + $real = 0; + } elsif ($a eq '--real') { + $real = 1; + } else { + die "$a ?"; + } +} + +die unless defined $real; my $gcfpid = open2 \*GCFO, \*GCFI, 'git cat-file --batch' or die $!;