File tree Expand file tree Collapse file tree 6 files changed +46
-8
lines changed Expand file tree Collapse file tree 6 files changed +46
-8
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,14 @@ diff.tool::
177
177
Any other value is treated as a custom diff tool and requires
178
178
that a corresponding difftool.<tool>.cmd variable is defined.
179
179
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
+
180
188
include::mergetools-diff.txt[]
181
189
182
190
diff.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.
79
79
Prompt before each invocation of the merge resolution program
80
80
to give the user a chance to skip the path.
81
81
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
+
82
93
-O<orderfile>::
83
94
Process files in the order specified in the
84
95
<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::
63
63
Any other value is treated as a custom merge tool and requires
64
64
that a corresponding mergetool.<tool>.cmd variable is defined.
65
65
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
+
66
72
include::mergetools-merge.txt[]
67
73
68
74
merge.verbosity::
Original file line number Diff line number Diff line change @@ -1822,7 +1822,7 @@ _git_mergetool ()
1822
1822
return
1823
1823
;;
1824
1824
--* )
1825
- __gitcomp " --tool= --prompt --no-prompt"
1825
+ __gitcomp " --tool= --prompt --no-prompt --gui --no-gui "
1826
1826
return
1827
1827
;;
1828
1828
esac
Original file line number Diff line number Diff line change @@ -350,17 +350,23 @@ guess_merge_tool () {
350
350
}
351
351
352
352
get_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
355
361
if diff_mode
356
362
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)
358
364
else
359
- merge_tool=$( git config merge.tool)
365
+ merge_tool=$( git config merge.${gui_prefix} tool)
360
366
fi
361
367
if test -n " $merge_tool " && ! valid_tool " $merge_tool "
362
368
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 "
364
370
echo >&2 " Resetting to default..."
365
371
return 1
366
372
fi
Original file line number Diff line number Diff line change 9
9
# at the discretion of Junio C Hamano.
10
10
#
11
11
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] ...'
13
13
SUBDIRECTORY_OK=Yes
14
14
NONGIT_OK=Yes
15
15
OPTIONS_SPEC=
@@ -389,6 +389,7 @@ print_noop_and_exit () {
389
389
390
390
main () {
391
391
prompt=$( git config --bool mergetool.prompt)
392
+ gui_tool=false
392
393
guessed_merge_tool=false
393
394
orderfile=
394
395
@@ -414,6 +415,12 @@ main () {
414
415
shift ;;
415
416
esac
416
417
;;
418
+ --no-gui)
419
+ gui_tool=false
420
+ ;;
421
+ -g|--gui)
422
+ gui_tool=true
423
+ ;;
417
424
-y|--no-prompt)
418
425
prompt=false
419
426
;;
@@ -443,7 +450,7 @@ main () {
443
450
if test -z " $merge_tool "
444
451
then
445
452
# Check if a merge tool has been configured
446
- merge_tool=$( get_configured_merge_tool)
453
+ merge_tool=$( get_configured_merge_tool $gui_tool )
447
454
# Try to guess an appropriate merge tool if no tool has been set.
448
455
if test -z " $merge_tool "
449
456
then
You can’t perform that action at this time.
0 commit comments