File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -177,6 +177,14 @@ diff.tool::
177177 Any other value is treated as a custom diff tool and requires
178178 that a corresponding difftool.<tool>.cmd variable is defined.
179179
180+ diff.guitool::
181+ Controls which diff tool is used by linkgit:git-difftool[1] when
182+ the -g/--gui flag is specified. This variable overrides the value
183+ configured in `merge.guitool`. The list below shows the valid
184+ built-in values. Any other value is treated as a custom diff tool
185+ and requires that a corresponding difftool.<guitool>.cmd variable
186+ is defined.
187+
180188include::mergetools-diff.txt[]
181189
182190diff.indentHeuristic::
Original file line number Diff line number Diff line change @@ -79,6 +79,17 @@ success of the resolution after the custom tool has exited.
7979 Prompt before each invocation of the merge resolution program
8080 to give the user a chance to skip the path.
8181
82+ -g::
83+ --gui::
84+ When 'git-mergetool' is invoked with the `-g` or `--gui` option
85+ the default merge tool will be read from the configured
86+ `merge.guitool` variable instead of `merge.tool`.
87+
88+ --no-gui::
89+ This overrides a previous `-g` or `--gui` setting and reads the
90+ default merge tool will be read from the configured `merge.tool`
91+ variable.
92+
8293-O<orderfile>::
8394 Process files in the order specified in the
8495 <orderfile>, which has one shell glob pattern per line.
Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ merge.tool::
6363 Any other value is treated as a custom merge tool and requires
6464 that a corresponding mergetool.<tool>.cmd variable is defined.
6565
66+ merge.guitool::
67+ Controls which merge tool is used by linkgit:git-mergetool[1] when the
68+ -g/--gui flag is specified. The list below shows the valid built-in values.
69+ Any other value is treated as a custom merge tool and requires that a
70+ corresponding mergetool.<guitool>.cmd variable is defined.
71+
6672include::mergetools-merge.txt[]
6773
6874merge.verbosity::
Original file line number Diff line number Diff line change @@ -1822,7 +1822,7 @@ _git_mergetool ()
18221822 return
18231823 ;;
18241824 --* )
1825- __gitcomp " --tool= --prompt --no-prompt"
1825+ __gitcomp " --tool= --prompt --no-prompt --gui --no-gui "
18261826 return
18271827 ;;
18281828 esac
Original file line number Diff line number Diff line change @@ -350,17 +350,23 @@ guess_merge_tool () {
350350}
351351
352352get_configured_merge_tool () {
353- # Diff mode first tries diff.tool and falls back to merge.tool.
354- # Merge mode only checks merge.tool
353+ # If first argument is true, find the guitool instead
354+ if test " $1 " = true
355+ then
356+ gui_prefix=gui
357+ fi
358+
359+ # Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool.
360+ # Merge mode only checks merge.(gui)tool
355361 if diff_mode
356362 then
357- merge_tool=$( git config diff.tool || git config merge.tool)
363+ merge_tool=$( git config diff.${gui_prefix} tool || git config merge.${gui_prefix} tool)
358364 else
359- merge_tool=$( git config merge.tool)
365+ merge_tool=$( git config merge.${gui_prefix} tool)
360366 fi
361367 if test -n " $merge_tool " && ! valid_tool " $merge_tool "
362368 then
363- echo >&2 " git config option $TOOL_MODE .tool set to unknown tool: $merge_tool "
369+ echo >&2 " git config option $TOOL_MODE .${gui_prefix} tool set to unknown tool: $merge_tool "
364370 echo >&2 " Resetting to default..."
365371 return 1
366372 fi
Original file line number Diff line number Diff line change 99# at the discretion of Junio C Hamano.
1010#
1111
12- USAGE=' [--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...'
12+ USAGE=' [--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [- O<orderfile>] [file to merge] ...'
1313SUBDIRECTORY_OK=Yes
1414NONGIT_OK=Yes
1515OPTIONS_SPEC=
@@ -389,6 +389,7 @@ print_noop_and_exit () {
389389
390390main () {
391391 prompt=$( git config --bool mergetool.prompt)
392+ gui_tool=false
392393 guessed_merge_tool=false
393394 orderfile=
394395
@@ -414,6 +415,12 @@ main () {
414415 shift ;;
415416 esac
416417 ;;
418+ --no-gui)
419+ gui_tool=false
420+ ;;
421+ -g|--gui)
422+ gui_tool=true
423+ ;;
417424 -y|--no-prompt)
418425 prompt=false
419426 ;;
@@ -443,7 +450,7 @@ main () {
443450 if test -z " $merge_tool "
444451 then
445452 # Check if a merge tool has been configured
446- merge_tool=$( get_configured_merge_tool)
453+ merge_tool=$( get_configured_merge_tool $gui_tool )
447454 # Try to guess an appropriate merge tool if no tool has been set.
448455 if test -z " $merge_tool "
449456 then
You can’t perform that action at this time.
0 commit comments