diff options
author | Denton Liu <liu.denton@gmail.com> | 2018-10-24 12:25:31 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-25 14:01:10 +0900 |
commit | 063f2bdbf767dd24bc0a35b5476d8025ee8646c7 (patch) | |
tree | 98d9c98da418e0193b7c541b191af809529e9264 /git-mergetool--lib.sh | |
parent | Fifth batch for 2.20 (diff) | |
download | tgif-063f2bdbf767dd24bc0a35b5476d8025ee8646c7.tar.xz |
mergetool: accept -g/--[no-]gui as arguments
In line with how difftool accepts a -g/--[no-]gui option, make mergetool
accept the same option in order to use the `merge.guitool` variable to
find the default mergetool instead of `merge.tool`.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Anmol Mago <anmolmago@gmail.com>
Signed-off-by: Brian Ho <briankyho@gmail.com>
Signed-off-by: David Lu <david.lu97@outlook.com>
Signed-off-by: Ryan Wang <shirui.wang@hotmail.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-mergetool--lib.sh')
-rw-r--r-- | git-mergetool--lib.sh | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 9a8b97a2ab..83bf52494c 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -350,17 +350,23 @@ guess_merge_tool () { } get_configured_merge_tool () { - # Diff mode first tries diff.tool and falls back to merge.tool. - # Merge mode only checks merge.tool + # If first argument is true, find the guitool instead + if test "$1" = true + then + gui_prefix=gui + fi + + # Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool. + # Merge mode only checks merge.(gui)tool if diff_mode then - merge_tool=$(git config diff.tool || git config merge.tool) + merge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool) else - merge_tool=$(git config merge.tool) + merge_tool=$(git config merge.${gui_prefix}tool) fi if test -n "$merge_tool" && ! valid_tool "$merge_tool" then - echo >&2 "git config option $TOOL_MODE.tool set to unknown tool: $merge_tool" + echo >&2 "git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool" echo >&2 "Resetting to default..." return 1 fi |