зеркало из https://github.com/microsoft/git.git
difftool: Fix failure on Cygwin
In particular, test 14 'difftool last flag wins' in t7800 fails. This is caused by git-difftool.perl passing both GIT_DIFFTOOL_NO_PROMPT (='true') and GIT_DIFFTOOL_PROMPT (='true') to the difftool helper script. Despite the appropriate key being deleted from the ENV hash, it seems that once a key has been set in the hash, it gets passed along to the system() call. (ie deleting the key does not do the equivalent of unsetenv()). In order to fix the problem, we keep track of the required prompt state while processing the arguments, and then set the relevant ENV hash key only once at the end. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
c6d059bbcc
Коммит
d531174fe3
|
@ -52,6 +52,7 @@ sub generate_command
|
||||||
my @command = (exe('git'), 'diff');
|
my @command = (exe('git'), 'diff');
|
||||||
my $skip_next = 0;
|
my $skip_next = 0;
|
||||||
my $idx = -1;
|
my $idx = -1;
|
||||||
|
my $prompt = '';
|
||||||
for my $arg (@ARGV) {
|
for my $arg (@ARGV) {
|
||||||
$idx++;
|
$idx++;
|
||||||
if ($skip_next) {
|
if ($skip_next) {
|
||||||
|
@ -89,13 +90,11 @@ sub generate_command
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if ($arg eq '-y' || $arg eq '--no-prompt') {
|
if ($arg eq '-y' || $arg eq '--no-prompt') {
|
||||||
$ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
|
$prompt = 'no';
|
||||||
delete $ENV{GIT_DIFFTOOL_PROMPT};
|
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if ($arg eq '--prompt') {
|
if ($arg eq '--prompt') {
|
||||||
$ENV{GIT_DIFFTOOL_PROMPT} = 'true';
|
$prompt = 'yes';
|
||||||
delete $ENV{GIT_DIFFTOOL_NO_PROMPT};
|
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if ($arg eq '-h' || $arg eq '--help') {
|
if ($arg eq '-h' || $arg eq '--help') {
|
||||||
|
@ -103,6 +102,11 @@ sub generate_command
|
||||||
}
|
}
|
||||||
push @command, $arg;
|
push @command, $arg;
|
||||||
}
|
}
|
||||||
|
if ($prompt eq 'yes') {
|
||||||
|
$ENV{GIT_DIFFTOOL_PROMPT} = 'true';
|
||||||
|
} elsif ($prompt eq 'no') {
|
||||||
|
$ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
|
||||||
|
}
|
||||||
return @command
|
return @command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче