difftool: fallback on merge.guitool

In git-difftool.txt, it says

	'git difftool' falls back to 'git mergetool' config variables when the
	difftool equivalents have not been defined.

However, when `diff.guitool` is missing, it doesn't fallback to
anything. Make git-difftool fallback to `merge.guitool` when `diff.guitool` is
missing.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Denton Liu
2019-04-29 02:21:20 -04:00
committed by Junio C Hamano
parent 7f978d7d10
commit 6c22d715e7
3 changed files with 21 additions and 9 deletions

View File

@ -279,11 +279,27 @@ test_expect_success 'difftool + mergetool config variables' '
echo branch >expect &&
git difftool --no-prompt branch >actual &&
test_cmp expect actual &&
git difftool --gui --no-prompt branch >actual &&
test_cmp expect actual &&
# set merge.tool to something bogus, diff.tool to test-tool
test_config merge.tool bogus-tool &&
test_config diff.tool test-tool &&
git difftool --no-prompt branch >actual &&
test_cmp expect actual &&
git difftool --gui --no-prompt branch >actual &&
test_cmp expect actual &&
# set merge.tool, diff.tool to something bogus, merge.guitool to test-tool
test_config diff.tool bogus-tool &&
test_config merge.guitool test-tool &&
git difftool --gui --no-prompt branch >actual &&
test_cmp expect actual &&
# set merge.tool, diff.tool, merge.guitool to something bogus, diff.guitool to test-tool
test_config merge.guitool bogus-tool &&
test_config diff.guitool test-tool &&
git difftool --gui --no-prompt branch >actual &&
test_cmp expect actual
'