File tree Expand file tree Collapse file tree 3 files changed +31
-7
lines changed Expand file tree Collapse file tree 3 files changed +31
-7
lines changed 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 @@ -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