提交 9f3d54d1 编写于 作者: D David Aguilar 提交者: Junio C Hamano

difftool: Use eval to expand '--extcmd' expressions

It was not possible to pass quoted commands to '--extcmd'.
By using 'eval' we ensure that expressions with spaces and
quotes are supported.
Signed-off-by: NDavid Aguilar <davvid@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 f47f1e2c
......@@ -48,11 +48,10 @@ launch_merge_tool () {
fi
if use_ext_cmd; then
$GIT_DIFFTOOL_EXTCMD "$LOCAL" "$REMOTE"
eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
else
run_merge_tool "$merge_tool"
fi
}
if ! use_ext_cmd; then
......
......@@ -235,8 +235,21 @@ test_expect_success 'difftool --extcmd cat' '
test_expect_success 'difftool -x cat' '
diff=$(git difftool --no-prompt -x cat branch) &&
test "$diff" = branch"$LF"master
'
test_expect_success 'difftool --extcmd echo arg1' '
diff=$(git difftool --no-prompt --extcmd sh\ -c\ \"echo\ \$1\" branch)
test "$diff" = file
'
test_expect_success 'difftool --extcmd cat arg1' '
diff=$(git difftool --no-prompt --extcmd sh\ -c\ \"cat\ \$1\" branch)
test "$diff" = master
'
test_expect_success 'difftool --extcmd cat arg2' '
diff=$(git difftool --no-prompt --extcmd sh\ -c\ \"cat\ \$2\" branch)
test "$diff" = branch
'
test_done
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册