Skip to content

Commit 4fb4b02

Browse files
hashplinggitster
authored andcommitted
difftool: don't assume that default sh is sane
git-difftool used to create a command list script containing $( ... ) and explicitly calls "sh -c" with this list. Instead, allow mergetool --tool-help to take a mode parameter and call mergetool directly to invoke the show_tool_help function. This mode parameter is intented for use solely by difftool. Signed-off-by: Charles Bailey <[email protected]> Helped-by: John Keeping <[email protected]> Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7bfb7c3 commit 4fb4b02

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

git-difftool.perl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,9 @@ sub find_worktree
4747

4848
sub print_tool_help
4949
{
50-
my $cmd = 'TOOL_MODE=diff';
51-
$cmd .= ' && . "$(git --exec-path)/git-mergetool--lib"';
52-
$cmd .= ' && show_tool_help';
53-
5450
# See the comment at the bottom of file_diff() for the reason behind
5551
# using system() followed by exit() instead of exec().
56-
my $rc = system('sh', '-c', $cmd);
52+
my $rc = system(qw(git mergetool --tool-help=diff));
5753
exit($rc | ($rc >> 8));
5854
}
5955

git-mergetool.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ prompt=$(git config --bool mergetool.prompt || echo true)
326326
while test $# != 0
327327
do
328328
case "$1" in
329+
--tool-help=*)
330+
TOOL_MODE=${1#--tool-help=}
331+
show_tool_help
332+
;;
329333
--tool-help)
330334
show_tool_help
331335
;;

0 commit comments

Comments
 (0)