зеркало из https://github.com/microsoft/git.git
git-difftool: use git-mergetool--lib for "--tool-help"
The "--tool-help" option to git-difftool currently displays incorrect output since it uses the names of the files in "$GIT_EXEC_PATH/mergetools/" rather than the list of command names in git-mergetool--lib. Fix this by simply delegating the "--tool-help" argument to the show_tool_help function in git-mergetool--lib. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
62b6f7e021
Коммит
abaf175cdf
|
@ -59,57 +59,16 @@ sub find_worktree
|
||||||
return $worktree;
|
return $worktree;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub filter_tool_scripts
|
|
||||||
{
|
|
||||||
my ($tools) = @_;
|
|
||||||
if (-d $_) {
|
|
||||||
if ($_ ne ".") {
|
|
||||||
# Ignore files in subdirectories
|
|
||||||
$File::Find::prune = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ((-f $_) && ($_ ne "defaults")) {
|
|
||||||
push(@$tools, $_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub print_tool_help
|
sub print_tool_help
|
||||||
{
|
{
|
||||||
my ($cmd, @found, @notfound, @tools);
|
my $cmd = 'TOOL_MODE=diff';
|
||||||
my $gitpath = Git::exec_path();
|
$cmd .= ' && . "$(git --exec-path)/git-mergetool--lib"';
|
||||||
|
$cmd .= ' && show_tool_help';
|
||||||
|
|
||||||
find(sub { filter_tool_scripts(\@tools) }, "$gitpath/mergetools");
|
# See the comment at the bottom of file_diff() for the reason behind
|
||||||
|
# using system() followed by exit() instead of exec().
|
||||||
foreach my $tool (@tools) {
|
my $rc = system('sh', '-c', $cmd);
|
||||||
$cmd = "TOOL_MODE=diff";
|
exit($rc | ($rc >> 8));
|
||||||
$cmd .= ' && . "$(git --exec-path)/git-mergetool--lib"';
|
|
||||||
$cmd .= " && get_merge_tool_path $tool >/dev/null 2>&1";
|
|
||||||
$cmd .= " && can_diff >/dev/null 2>&1";
|
|
||||||
if (system('sh', '-c', $cmd) == 0) {
|
|
||||||
push(@found, $tool);
|
|
||||||
} else {
|
|
||||||
push(@notfound, $tool);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print << 'EOF';
|
|
||||||
'git difftool --tool=<tool>' may be set to one of the following:
|
|
||||||
EOF
|
|
||||||
print "\t$_\n" for (sort(@found));
|
|
||||||
|
|
||||||
print << 'EOF';
|
|
||||||
|
|
||||||
The following tools are valid, but not currently available:
|
|
||||||
EOF
|
|
||||||
print "\t$_\n" for (sort(@notfound));
|
|
||||||
|
|
||||||
print << 'EOF';
|
|
||||||
|
|
||||||
NOTE: Some of the tools listed above only work in a windowed
|
|
||||||
environment. If run in a terminal-only session, they will fail.
|
|
||||||
EOF
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub exit_cleanup
|
sub exit_cleanup
|
||||||
|
|
Загрузка…
Ссылка в новой задаче