Teach implied-commit-order to support the --gitk option
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 27 Dec 2013 02:35:13 +0000 (26 20:35 -0600)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 28 Dec 2013 00:02:04 +0000 (27 18:02 -0600)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
share/msysGit/implied-commit-order.perl

index 0dffaf3..2f3f809 100755 (executable)
@@ -361,6 +361,20 @@ sub read_commits ($) {
        close($in);
 }
 
+my $use_gitk = 0;
+my $dashdash = -1;
+for (my $i = 0; $i <= $#ARGV; $i++) {
+       if ($ARGV[$i] eq '--') {
+               $dashdash = $i;
+               last;
+       }
+       if ($ARGV[$i] eq '--gitk') {
+               $use_gitk = 1;
+               splice(@ARGV, $i, 1);
+               $i--;
+       }
+}
+
 read_commits(\@ARGV);
 
 # Unfortunately, there is no scriptable way to use the --graph support of `git
@@ -400,6 +414,10 @@ sub show () {
                push(@args, @ARGV[$i..$#ARGV]) if $i <= $#ARGV;
                last;
        }
+       if ($use_gitk) {
+               splice(@args, 0, 3);
+               exec('gitk', @args);
+       }
        exec('git', @args);
 }