Files
git/Documentation
Denton Liu 60aced3dfa mergetool: fallback to tool when guitool unavailable
In git-difftool, if the tool is called with --gui but `diff.guitool` is
not set, it falls back to `diff.tool`. Make git-mergetool also fallback
from `merge.guitool` to `merge.tool` if the former is undefined.

If git-difftool, when called with `--gui`, were to use
`get_configured_mergetool` in a future patch, it would also get the
fallback behavior in the following precedence:

1. diff.guitool
2. merge.guitool
3. diff.tool
4. merge.tool

The behavior for when difftool or mergetool are called without `--gui`
should be identical with or without this patch.

Note that the search loop could be written as

	sections="merge"
	keys="tool"
	if diff_mode
	then
		sections="diff $sections"
	fi
	if gui_mode
	then
		keys="guitool $keys"
	fi

	merge_tool=$(
		IFS=' '
		for key in $keys
		do
			for section in $sections
			do
				selected=$(git config $section.$key)
				if test -n "$selected"
				then
					echo "$selected"
					return
				fi
			done
		done)

which would make adding a mode in the future much easier. However,
adding a new mode will likely never happen as it is highly discouraged
so, as a result, it is written in its current form so that it is more
readable for future readers.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-13 23:11:59 +09:00
..
2018-10-19 13:52:51 +09:00
2018-06-25 13:22:36 -07:00
2018-05-23 14:38:22 +09:00
2018-06-27 10:29:10 -07:00
2018-10-03 21:25:57 -07:00
2018-08-01 13:37:18 -07:00
2018-10-07 10:11:02 +09:00
2016-08-11 14:35:42 -07:00
2018-09-17 13:53:55 -07:00
2017-06-27 10:35:49 -07:00
2018-04-18 12:49:26 +09:00