Skip to content

Commit ea95907

Browse files
committed
Merge branch 'rj/maint-difftool-cygwin-workaround' into maint
* rj/maint-difftool-cygwin-workaround: difftool: Fix failure on Cygwin
2 parents f8d0215 + d531174 commit ea95907

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

git-difftool.perl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ sub generate_command
5252
my @command = (exe('git'), 'diff');
5353
my $skip_next = 0;
5454
my $idx = -1;
55+
my $prompt = '';
5556
for my $arg (@ARGV) {
5657
$idx++;
5758
if ($skip_next) {
@@ -89,20 +90,23 @@ sub generate_command
8990
next;
9091
}
9192
if ($arg eq '-y' || $arg eq '--no-prompt') {
92-
$ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
93-
delete $ENV{GIT_DIFFTOOL_PROMPT};
93+
$prompt = 'no';
9494
next;
9595
}
9696
if ($arg eq '--prompt') {
97-
$ENV{GIT_DIFFTOOL_PROMPT} = 'true';
98-
delete $ENV{GIT_DIFFTOOL_NO_PROMPT};
97+
$prompt = 'yes';
9998
next;
10099
}
101100
if ($arg eq '-h' || $arg eq '--help') {
102101
usage();
103102
}
104103
push @command, $arg;
105104
}
105+
if ($prompt eq 'yes') {
106+
$ENV{GIT_DIFFTOOL_PROMPT} = 'true';
107+
} elsif ($prompt eq 'no') {
108+
$ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
109+
}
106110
return @command
107111
}
108112

0 commit comments

Comments
 (0)