diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-01-05 17:40:45 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-01-05 17:40:45 +0000 |
commit | 270c257f81665d1bcfab1ca4a3d831b5bcabc034 (patch) | |
tree | 9f0bf29e69c74d6ce5974452f96071aa739f0717 | |
parent | 6f69676c5ca035f70488e4b73c07ee1113b49bb3 (diff) |
badcommit-fixup: reorganise arg parsing
-rwxr-xr-x | badcommit-fixup | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/badcommit-fixup b/badcommit-fixup index b8cb88a..ca2e0df 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 $!; |