{"thread":{"id":"49657","subject":"[PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments","startedAt":"2018-10-24T02:51:54Z","lastAt":"2018-10-26T13:15:32Z","messageCount":15,"participants":["Denton Liu","Junio C Hamano","David Aguilar"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"361344","messageId":"20181024022500.GA29011@archbookpro.localdomain","threadId":"49657","inReplyTo":null,"subject":"[PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-24T02:25:00Z","receivedAt":"2018-10-24T02:51:54Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In line with how difftool accepts a -g/--[no-]gui option, make mergetool\naccept the same option in order to use the `merge.guitool` variable to\nfind the default mergetool instead of `merge.tool`.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\nSigned-off-by: Anmol Mago <anmolmago@gmail.com>\nSigned-off-by: Brian Ho <briankyho@gmail.com>\nSigned-off-by: David Lu <david.lu97@outlook.com>\nSigned-off-by: Ryan Wang <shirui.wang@hotmail.com>\n---\n Documentation/git-mergetool.txt | 11 +++++++++++\n git-mergetool--lib.sh           | 16 +++++++++++-----\n git-mergetool.sh                | 11 +++++++++--\n 3 files changed, 31 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt\nindex 3622d6648..0c7975a05 100644\n--- a/Documentation/git-mergetool.txt\n+++ b/Documentation/git-mergetool.txt\n@@ -79,6 +79,17 @@ success of the resolution after the custom tool has exited.\n \tPrompt before each invocation of the merge resolution program\n \tto give the user a chance to skip the path.\n \n+-g::\n+--gui::\n+\tWhen 'git-mergetool' is invoked with the `-g` or `--gui` option\n+\tthe default merge tool will be read from the configured\n+\t`merge.guitool` variable instead of `merge.tool`.\n+\n+--no-gui::\n+\tThis overrides a previous `-g` or `--gui` setting and reads the\n+\tdefault merge tool will be read from the configured `merge.tool`\n+\tvariable.\n+\n -O<orderfile>::\n \tProcess files in the order specified in the\n \t<orderfile>, which has one shell glob pattern per line.\ndiff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\nindex 9a8b97a2a..e317ae003 100644\n--- a/git-mergetool--lib.sh\n+++ b/git-mergetool--lib.sh\n@@ -350,17 +350,23 @@ guess_merge_tool () {\n }\n \n get_configured_merge_tool () {\n-\t# Diff mode first tries diff.tool and falls back to merge.tool.\n-\t# Merge mode only checks merge.tool\n+\t# If first argument is true, find the guitool instead\n+\tif [ \"$1\" = true ]\n+\tthen\n+\t\tgui_prefix=gui\n+\tfi\n+\n+\t# Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool.\n+\t# Merge mode only checks merge.(gui)tool\n \tif diff_mode\n \tthen\n-\t\tmerge_tool=$(git config diff.tool || git config merge.tool)\n+\t\tmerge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool)\n \telse\n-\t\tmerge_tool=$(git config merge.tool)\n+\t\tmerge_tool=$(git config merge.${gui_prefix}tool)\n \tfi\n \tif test -n \"$merge_tool\" && ! valid_tool \"$merge_tool\"\n \tthen\n-\t\techo >&2 \"git config option $TOOL_MODE.tool set to unknown tool: $merge_tool\"\n+\t\techo >&2 \"git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool\"\n \t\techo >&2 \"Resetting to default...\"\n \t\treturn 1\n \tfi\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex d07c7f387..01b9ad59b 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -9,7 +9,7 @@\n # at the discretion of Junio C Hamano.\n #\n \n-USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...'\n+USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...'\n SUBDIRECTORY_OK=Yes\n NONGIT_OK=Yes\n OPTIONS_SPEC=\n@@ -389,6 +389,7 @@ print_noop_and_exit () {\n \n main () {\n \tprompt=$(git config --bool mergetool.prompt)\n+\tgui_tool=false\n \tguessed_merge_tool=false\n \torderfile=\n \n@@ -414,6 +415,12 @@ main () {\n \t\t\t\tshift ;;\n \t\t\tesac\n \t\t\t;;\n+\t\t--no-gui)\n+\t\t\tgui_tool=false\n+\t\t\t;;\n+\t\t-g|--gui)\n+\t\t\tgui_tool=true\n+\t\t\t;;\n \t\t-y|--no-prompt)\n \t\t\tprompt=false\n \t\t\t;;\n@@ -443,7 +450,7 @@ main () {\n \tif test -z \"$merge_tool\"\n \tthen\n \t\t# Check if a merge tool has been configured\n-\t\tmerge_tool=$(get_configured_merge_tool)\n+\t\tmerge_tool=$(get_configured_merge_tool $gui_tool)\n \t\t# Try to guess an appropriate merge tool if no tool has been set.\n \t\tif test -z \"$merge_tool\"\n \t\tthen\n-- \n2.19.1\n\n"},{"id":"361362","messageId":"xmqqy3aond55.fsf@gitster-ct.c.googlers.com","threadId":"49657","inReplyTo":"20181024022500.GA29011@archbookpro.localdomain","subject":"Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-10-24T05:10:14Z","receivedAt":"2018-10-24T05:10:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> Subject: Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments\n\nOther people may point it out, but s/Accept/accept/.\n\n> In line with how difftool accepts a -g/--[no-]gui option, make mergetool\n> accept the same option in order to use the `merge.guitool` variable to\n> find the default mergetool instead of `merge.tool`.\n> ...\n> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\n> index 9a8b97a2a..e317ae003 100644\n> --- a/git-mergetool--lib.sh\n> +++ b/git-mergetool--lib.sh\n> @@ -350,17 +350,23 @@ guess_merge_tool () {\n>  }\n>  \n>  get_configured_merge_tool () {\n> -\t# Diff mode first tries diff.tool and falls back to merge.tool.\n> -\t# Merge mode only checks merge.tool\n> +\t# If first argument is true, find the guitool instead\n> +\tif [ \"$1\" = true ]\n\nDon't use [] in our shell script (see Documentation/CodingGuidelines);\nsay\n\n\tif \"$1\" = true\n\ninstead.\n\n> +\tthen\n> +\t\tgui_prefix=gui\n> +\tfi\n> +\n> +\t# Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool.\n> +\t# Merge mode only checks merge.(gui)tool\n>  \tif diff_mode\n>  \tthen\n> -\t\tmerge_tool=$(git config diff.tool || git config merge.tool)\n> +\t\tmerge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool)\n>  \telse\n> -\t\tmerge_tool=$(git config merge.tool)\n> +\t\tmerge_tool=$(git config merge.${gui_prefix}tool)\n>  \tfi\n\nIn mode_ok shell function, we seem to be prepared to deal with a\ncase where neither diff_mode nor merge_mode is true.  Should this\ncodepath also be prepared to?  \n\nThis is not a comment to point out an issue with this patch.  It is\na genuine question on the code after (or before for that matter)\nthis patch is applied.\n\nThanks.\n"},{"id":"361365","messageId":"20181024053021.GA14408@archbookpro.localdomain","threadId":"49657","inReplyTo":"xmqqy3aond55.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-24T05:30:21Z","receivedAt":"2018-10-24T05:30:26Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"On Wed, Oct 24, 2018 at 02:10:14PM +0900, Junio C Hamano wrote:\n> In mode_ok shell function, we seem to be prepared to deal with a\n> case where neither diff_mode nor merge_mode is true.  Should this\n> codepath also be prepared to?  \n> \n\nAccording to Documentation/git-mergetool--lib.txt,\n\n>Before sourcing 'git-mergetool{litdd}lib', your script must set `TOOL_MODE`\n>to define the operation mode for the functions listed below.\n>'diff' and 'merge' are valid values.\n\nso I think that we can assume that the one of diff_mode or merge_mode\nwill return true. In any case, it seems like the rest of the code was\nwritten under this assumption so if this needs to be changed then the\nwhole library needs to be fixed as well.\n"},{"id":"361367","messageId":"20181024053656.GA2985@gmail.com","threadId":"49657","inReplyTo":"xmqqy3aond55.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2018-10-24T05:44:16Z","receivedAt":"2018-10-24T05:44:24Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Wed, Oct 24, 2018 at 02:10:14PM +0900, Junio C Hamano wrote:\n> Denton Liu <liu.denton@gmail.com> writes:\n> \n> > Subject: Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments\n> \n> Other people may point it out, but s/Accept/accept/.\n> \n> > In line with how difftool accepts a -g/--[no-]gui option, make mergetool\n> > accept the same option in order to use the `merge.guitool` variable to\n> > find the default mergetool instead of `merge.tool`.\n> > ...\n> > diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\n> > index 9a8b97a2a..e317ae003 100644\n> > --- a/git-mergetool--lib.sh\n> > +++ b/git-mergetool--lib.sh\n> > @@ -350,17 +350,23 @@ guess_merge_tool () {\n> >  }\n> >  \n> >  get_configured_merge_tool () {\n> > -\t# Diff mode first tries diff.tool and falls back to merge.tool.\n> > -\t# Merge mode only checks merge.tool\n> > +\t# If first argument is true, find the guitool instead\n> > +\tif [ \"$1\" = true ]\n> \n> Don't use [] in our shell script (see Documentation/CodingGuidelines);\n> say\n> \n> \tif \"$1\" = true\n> \n> instead.\n\nPerhaps a small typo dropped \"test\" -- I think it should be\n\n\tif test \"$1\" = true\n\n\n> > +\t# Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool.\n> > +\t# Merge mode only checks merge.(gui)tool\n> >  \tif diff_mode\n> >  \tthen\n> > -\t\tmerge_tool=$(git config diff.tool || git config merge.tool)\n> > +\t\tmerge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool)\n> >  \telse\n> > -\t\tmerge_tool=$(git config merge.tool)\n> > +\t\tmerge_tool=$(git config merge.${gui_prefix}tool)\n> >  \tfi\n> \n> In mode_ok shell function, we seem to be prepared to deal with a\n> case where neither diff_mode nor merge_mode is true.  Should this\n> codepath also be prepared to?  \n> \n> This is not a comment to point out an issue with this patch.  It is\n> a genuine question on the code after (or before for that matter)\n> this patch is applied.\n> \n> Thanks.\n\n\nI think the code is okay.  mode_ok is setup that way to allow filtering\nfor the other mode's tools, but this code path is only concerned with\ngetting the default merge tool, which should only ever happen in one of\nthe two modes.\n\nThe bit about difftool falling back to mergetool's config is a\nconvenience so it does make sense to keep that for guitool as well.\n\nThe code after this part should handle merge_tool being empty just fine,\nso once the `[ ... ]` vs `test` bit is updated, please feel free to add:\n\nAcked-by: David Aguilar <davvid@gmail.com>\n\n\ncheers,\n-- \nDavid\n"},{"id":"361369","messageId":"b0a5d6926c130c0b143435a96ed956b3ed20dad7.1540360514.git.liu.denton@gmail.com","threadId":"49657","inReplyTo":"xmqqy3aond55.fsf@gitster-ct.c.googlers.com","subject":"[PATCH v2 1/2] mergetool: accept -g/--[no-]gui as arguments","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-24T05:58:00Z","receivedAt":"2018-10-24T05:58:05Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In line with how difftool accepts a -g/--[no-]gui option, make mergetool\naccept the same option in order to use the `merge.guitool` variable to\nfind the default mergetool instead of `merge.tool`.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\nSigned-off-by: Anmol Mago <anmolmago@gmail.com>\nSigned-off-by: Brian Ho <briankyho@gmail.com>\nSigned-off-by: David Lu <david.lu97@outlook.com>\nSigned-off-by: Ryan Wang <shirui.wang@hotmail.com>\nAcked-by: David Aguilar <davvid@gmail.com>\n---\n Documentation/git-mergetool.txt | 11 +++++++++++\n git-mergetool--lib.sh           | 16 +++++++++++-----\n git-mergetool.sh                | 11 +++++++++--\n 3 files changed, 31 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt\nindex 3622d6648..0c7975a05 100644\n--- a/Documentation/git-mergetool.txt\n+++ b/Documentation/git-mergetool.txt\n@@ -79,6 +79,17 @@ success of the resolution after the custom tool has exited.\n \tPrompt before each invocation of the merge resolution program\n \tto give the user a chance to skip the path.\n \n+-g::\n+--gui::\n+\tWhen 'git-mergetool' is invoked with the `-g` or `--gui` option\n+\tthe default merge tool will be read from the configured\n+\t`merge.guitool` variable instead of `merge.tool`.\n+\n+--no-gui::\n+\tThis overrides a previous `-g` or `--gui` setting and reads the\n+\tdefault merge tool will be read from the configured `merge.tool`\n+\tvariable.\n+\n -O<orderfile>::\n \tProcess files in the order specified in the\n \t<orderfile>, which has one shell glob pattern per line.\ndiff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\nindex 9a8b97a2a..83bf52494 100644\n--- a/git-mergetool--lib.sh\n+++ b/git-mergetool--lib.sh\n@@ -350,17 +350,23 @@ guess_merge_tool () {\n }\n \n get_configured_merge_tool () {\n-\t# Diff mode first tries diff.tool and falls back to merge.tool.\n-\t# Merge mode only checks merge.tool\n+\t# If first argument is true, find the guitool instead\n+\tif test \"$1\" = true\n+\tthen\n+\t\tgui_prefix=gui\n+\tfi\n+\n+\t# Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool.\n+\t# Merge mode only checks merge.(gui)tool\n \tif diff_mode\n \tthen\n-\t\tmerge_tool=$(git config diff.tool || git config merge.tool)\n+\t\tmerge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool)\n \telse\n-\t\tmerge_tool=$(git config merge.tool)\n+\t\tmerge_tool=$(git config merge.${gui_prefix}tool)\n \tfi\n \tif test -n \"$merge_tool\" && ! valid_tool \"$merge_tool\"\n \tthen\n-\t\techo >&2 \"git config option $TOOL_MODE.tool set to unknown tool: $merge_tool\"\n+\t\techo >&2 \"git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool\"\n \t\techo >&2 \"Resetting to default...\"\n \t\treturn 1\n \tfi\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex d07c7f387..01b9ad59b 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -9,7 +9,7 @@\n # at the discretion of Junio C Hamano.\n #\n \n-USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...'\n+USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...'\n SUBDIRECTORY_OK=Yes\n NONGIT_OK=Yes\n OPTIONS_SPEC=\n@@ -389,6 +389,7 @@ print_noop_and_exit () {\n \n main () {\n \tprompt=$(git config --bool mergetool.prompt)\n+\tgui_tool=false\n \tguessed_merge_tool=false\n \torderfile=\n \n@@ -414,6 +415,12 @@ main () {\n \t\t\t\tshift ;;\n \t\t\tesac\n \t\t\t;;\n+\t\t--no-gui)\n+\t\t\tgui_tool=false\n+\t\t\t;;\n+\t\t-g|--gui)\n+\t\t\tgui_tool=true\n+\t\t\t;;\n \t\t-y|--no-prompt)\n \t\t\tprompt=false\n \t\t\t;;\n@@ -443,7 +450,7 @@ main () {\n \tif test -z \"$merge_tool\"\n \tthen\n \t\t# Check if a merge tool has been configured\n-\t\tmerge_tool=$(get_configured_merge_tool)\n+\t\tmerge_tool=$(get_configured_merge_tool $gui_tool)\n \t\t# Try to guess an appropriate merge tool if no tool has been set.\n \t\tif test -z \"$merge_tool\"\n \t\tthen\n-- \n2.19.1\n\n"},{"id":"361370","messageId":"e0b0585a17bb0b3f43fd930b449b9bc631d58f0f.1540360514.git.liu.denton@gmail.com","threadId":"49657","inReplyTo":"xmqqy3aond55.fsf@gitster-ct.c.googlers.com","subject":"[PATCH v2 2/2] completion: support `git mergetool --[no-]gui`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-24T05:58:14Z","receivedAt":"2018-10-24T05:58:18Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Signed-off-by: Denton Liu <liu.denton@gmail.com>\nSigned-off-by: Anmol Mago <anmolmago@gmail.com>\nSigned-off-by: Brian Ho <briankyho@gmail.com>\nSigned-off-by: David Lu <david.lu97@outlook.com>\nSigned-off-by: Ryan Wang <shirui.wang@hotmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex db7fd87b6..a45b4a050 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1833,7 +1833,7 @@ _git_mergetool ()\n \t\treturn\n \t\t;;\n \t--*)\n-\t\t__gitcomp \"--tool= --prompt --no-prompt\"\n+\t\t__gitcomp \"--tool= --prompt --no-prompt --gui --no-gui\"\n \t\treturn\n \t\t;;\n \tesac\n-- \n2.19.1\n\n"},{"id":"361427","messageId":"cover.1540398076.git.liu.denton@gmail.com","threadId":"49657","inReplyTo":"b0a5d6926c130c0b143435a96ed956b3ed20dad7.1540360514.git.liu.denton@gmail.com","subject":"[PATCH v3 0/3] Add --gui to mergetool","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-24T16:25:22Z","receivedAt":"2018-10-24T16:25:27Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"This adds another patch on top of the existing patchset in order to document the\nguitool keys for `git config`. This way, the completions script will now be able\nto complete these key values as well.\n\nDenton Liu (3):\n  mergetool: accept -g/--[no-]gui as arguments\n  completion: support `git mergetool --[no-]gui`\n  doc: document diff/merge.guitool config keys\n\n Documentation/diff-config.txt          |  8 ++++++++\n Documentation/git-mergetool.txt        | 11 +++++++++++\n Documentation/merge-config.txt         |  6 ++++++\n contrib/completion/git-completion.bash |  2 +-\n git-mergetool--lib.sh                  | 16 +++++++++++-----\n git-mergetool.sh                       | 11 +++++++++--\n 6 files changed, 46 insertions(+), 8 deletions(-)\n\n-- \n2.19.1.544.ge0b0585a1.dirty\n\n"},{"id":"361428","messageId":"b0a5d6926c130c0b143435a96ed956b3ed20dad7.1540398076.git.liu.denton@gmail.com","threadId":"49657","inReplyTo":"cover.1540398076.git.liu.denton@gmail.com","subject":"[PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-24T16:25:31Z","receivedAt":"2018-10-24T16:25:36Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In line with how difftool accepts a -g/--[no-]gui option, make mergetool\naccept the same option in order to use the `merge.guitool` variable to\nfind the default mergetool instead of `merge.tool`.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\nSigned-off-by: Anmol Mago <anmolmago@gmail.com>\nSigned-off-by: Brian Ho <briankyho@gmail.com>\nSigned-off-by: David Lu <david.lu97@outlook.com>\nSigned-off-by: Ryan Wang <shirui.wang@hotmail.com>\nAcked-by: David Aguilar <davvid@gmail.com>\n---\n Documentation/git-mergetool.txt | 11 +++++++++++\n git-mergetool--lib.sh           | 16 +++++++++++-----\n git-mergetool.sh                | 11 +++++++++--\n 3 files changed, 31 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt\nindex 3622d6648..0c7975a05 100644\n--- a/Documentation/git-mergetool.txt\n+++ b/Documentation/git-mergetool.txt\n@@ -79,6 +79,17 @@ success of the resolution after the custom tool has exited.\n \tPrompt before each invocation of the merge resolution program\n \tto give the user a chance to skip the path.\n \n+-g::\n+--gui::\n+\tWhen 'git-mergetool' is invoked with the `-g` or `--gui` option\n+\tthe default merge tool will be read from the configured\n+\t`merge.guitool` variable instead of `merge.tool`.\n+\n+--no-gui::\n+\tThis overrides a previous `-g` or `--gui` setting and reads the\n+\tdefault merge tool will be read from the configured `merge.tool`\n+\tvariable.\n+\n -O<orderfile>::\n \tProcess files in the order specified in the\n \t<orderfile>, which has one shell glob pattern per line.\ndiff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\nindex 9a8b97a2a..83bf52494 100644\n--- a/git-mergetool--lib.sh\n+++ b/git-mergetool--lib.sh\n@@ -350,17 +350,23 @@ guess_merge_tool () {\n }\n \n get_configured_merge_tool () {\n-\t# Diff mode first tries diff.tool and falls back to merge.tool.\n-\t# Merge mode only checks merge.tool\n+\t# If first argument is true, find the guitool instead\n+\tif test \"$1\" = true\n+\tthen\n+\t\tgui_prefix=gui\n+\tfi\n+\n+\t# Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool.\n+\t# Merge mode only checks merge.(gui)tool\n \tif diff_mode\n \tthen\n-\t\tmerge_tool=$(git config diff.tool || git config merge.tool)\n+\t\tmerge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool)\n \telse\n-\t\tmerge_tool=$(git config merge.tool)\n+\t\tmerge_tool=$(git config merge.${gui_prefix}tool)\n \tfi\n \tif test -n \"$merge_tool\" && ! valid_tool \"$merge_tool\"\n \tthen\n-\t\techo >&2 \"git config option $TOOL_MODE.tool set to unknown tool: $merge_tool\"\n+\t\techo >&2 \"git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool\"\n \t\techo >&2 \"Resetting to default...\"\n \t\treturn 1\n \tfi\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex d07c7f387..01b9ad59b 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -9,7 +9,7 @@\n # at the discretion of Junio C Hamano.\n #\n \n-USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...'\n+USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...'\n SUBDIRECTORY_OK=Yes\n NONGIT_OK=Yes\n OPTIONS_SPEC=\n@@ -389,6 +389,7 @@ print_noop_and_exit () {\n \n main () {\n \tprompt=$(git config --bool mergetool.prompt)\n+\tgui_tool=false\n \tguessed_merge_tool=false\n \torderfile=\n \n@@ -414,6 +415,12 @@ main () {\n \t\t\t\tshift ;;\n \t\t\tesac\n \t\t\t;;\n+\t\t--no-gui)\n+\t\t\tgui_tool=false\n+\t\t\t;;\n+\t\t-g|--gui)\n+\t\t\tgui_tool=true\n+\t\t\t;;\n \t\t-y|--no-prompt)\n \t\t\tprompt=false\n \t\t\t;;\n@@ -443,7 +450,7 @@ main () {\n \tif test -z \"$merge_tool\"\n \tthen\n \t\t# Check if a merge tool has been configured\n-\t\tmerge_tool=$(get_configured_merge_tool)\n+\t\tmerge_tool=$(get_configured_merge_tool $gui_tool)\n \t\t# Try to guess an appropriate merge tool if no tool has been set.\n \t\tif test -z \"$merge_tool\"\n \t\tthen\n-- \n2.19.1.544.ge0b0585a1.dirty\n\n"},{"id":"361429","messageId":"e0b0585a17bb0b3f43fd930b449b9bc631d58f0f.1540398076.git.liu.denton@gmail.com","threadId":"49657","inReplyTo":"cover.1540398076.git.liu.denton@gmail.com","subject":"[PATCH v3 2/3] completion: support `git mergetool --[no-]gui`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-24T16:25:37Z","receivedAt":"2018-10-24T16:25:41Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Signed-off-by: Denton Liu <liu.denton@gmail.com>\nSigned-off-by: Anmol Mago <anmolmago@gmail.com>\nSigned-off-by: Brian Ho <briankyho@gmail.com>\nSigned-off-by: David Lu <david.lu97@outlook.com>\nSigned-off-by: Ryan Wang <shirui.wang@hotmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex db7fd87b6..a45b4a050 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1833,7 +1833,7 @@ _git_mergetool ()\n \t\treturn\n \t\t;;\n \t--*)\n-\t\t__gitcomp \"--tool= --prompt --no-prompt\"\n+\t\t__gitcomp \"--tool= --prompt --no-prompt --gui --no-gui\"\n \t\treturn\n \t\t;;\n \tesac\n-- \n2.19.1.544.ge0b0585a1.dirty\n\n"},{"id":"361430","messageId":"a1009e0721c4f888855e2570d5b082330eb7d1d3.1540398076.git.liu.denton@gmail.com","threadId":"49657","inReplyTo":"cover.1540398076.git.liu.denton@gmail.com","subject":"[PATCH v3 3/3] doc: document diff/merge.guitool config keys","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-24T16:25:43Z","receivedAt":"2018-10-24T16:25:47Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Signed-off-by: Denton Liu <liu.denton@gmail.com>\n---\n Documentation/diff-config.txt  | 8 ++++++++\n Documentation/merge-config.txt | 6 ++++++\n 2 files changed, 14 insertions(+)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 85bca83c3..e64d983c3 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -177,6 +177,14 @@ diff.tool::\n \tAny other value is treated as a custom diff tool and requires\n \tthat a corresponding difftool.<tool>.cmd variable is defined.\n \n+diff.guitool::\n+\tControls which diff tool is used by linkgit:git-difftool[1] when\n+\tthe -g/--gui flag is specified. This variable overrides the value\n+\tconfigured in `merge.guitool`. The list below shows the valid\n+\tbuilt-in values. Any other value is treated as a custom diff tool\n+\tand requires that a corresponding difftool.<guitool>.cmd variable\n+\tis defined.\n+\n include::mergetools-diff.txt[]\n \n diff.indentHeuristic::\ndiff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt\nindex 662c2713c..a7f4ea90c 100644\n--- a/Documentation/merge-config.txt\n+++ b/Documentation/merge-config.txt\n@@ -63,6 +63,12 @@ merge.tool::\n \tAny other value is treated as a custom merge tool and requires\n \tthat a corresponding mergetool.<tool>.cmd variable is defined.\n \n+merge.guitool::\n+\tControls which merge tool is used by linkgit:git-mergetool[1] when the\n+\t-g/--gui flag is specified. The list below shows the valid built-in values.\n+\tAny other value is treated as a custom merge tool and requires that a\n+\tcorresponding mergetool.<guitool>.cmd variable is defined.\n+\n include::mergetools-merge.txt[]\n \n merge.verbosity::\n-- \n2.19.1.544.ge0b0585a1.dirty\n\n"},{"id":"361599","messageId":"20181026061111.GA7242@archbookpro.localdomain","threadId":"49657","inReplyTo":"cover.1540398076.git.liu.denton@gmail.com","subject":"[RESEND PATCH v3 0/3] Add --gui to mergetool","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-26T06:11:11Z","receivedAt":"2018-10-26T06:11:17Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"This is a resend of patchset v3 where we add another patch on top of the\nexisting patchset in order to document the guitool keys for `git\nconfig`. This way, the completions script will now be able to complete\nthese key values as well.\n\nDenton Liu (3):\n  mergetool: accept -g/--[no-]gui as arguments\n  completion: support `git mergetool --[no-]gui`\n  doc: document diff/merge.guitool config keys\n\n Documentation/diff-config.txt          |  8 ++++++++\n Documentation/git-mergetool.txt        | 11 +++++++++++\n Documentation/merge-config.txt         |  6 ++++++\n contrib/completion/git-completion.bash |  2 +-\n git-mergetool--lib.sh                  | 16 +++++++++++-----\n git-mergetool.sh                       | 11 +++++++++--\n 6 files changed, 46 insertions(+), 8 deletions(-)\n\n-- \n2.19.1\n\n"},{"id":"361600","messageId":"20181026061118.GA7295@archbookpro.localdomain","threadId":"49657","inReplyTo":"cover.1540398076.git.liu.denton@gmail.com","subject":"[RESEND PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-26T06:11:18Z","receivedAt":"2018-10-26T06:11:24Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In line with how difftool accepts a -g/--[no-]gui option, make mergetool\naccept the same option in order to use the `merge.guitool` variable to\nfind the default mergetool instead of `merge.tool`.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\nSigned-off-by: Anmol Mago <anmolmago@gmail.com>\nSigned-off-by: Brian Ho <briankyho@gmail.com>\nSigned-off-by: David Lu <david.lu97@outlook.com>\nSigned-off-by: Ryan Wang <shirui.wang@hotmail.com>\nAcked-by: David Aguilar <davvid@gmail.com>\n---\n Documentation/git-mergetool.txt | 11 +++++++++++\n git-mergetool--lib.sh           | 16 +++++++++++-----\n git-mergetool.sh                | 11 +++++++++--\n 3 files changed, 31 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt\nindex 3622d6648..0c7975a05 100644\n--- a/Documentation/git-mergetool.txt\n+++ b/Documentation/git-mergetool.txt\n@@ -79,6 +79,17 @@ success of the resolution after the custom tool has exited.\n \tPrompt before each invocation of the merge resolution program\n \tto give the user a chance to skip the path.\n \n+-g::\n+--gui::\n+\tWhen 'git-mergetool' is invoked with the `-g` or `--gui` option\n+\tthe default merge tool will be read from the configured\n+\t`merge.guitool` variable instead of `merge.tool`.\n+\n+--no-gui::\n+\tThis overrides a previous `-g` or `--gui` setting and reads the\n+\tdefault merge tool will be read from the configured `merge.tool`\n+\tvariable.\n+\n -O<orderfile>::\n \tProcess files in the order specified in the\n \t<orderfile>, which has one shell glob pattern per line.\ndiff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\nindex 9a8b97a2a..83bf52494 100644\n--- a/git-mergetool--lib.sh\n+++ b/git-mergetool--lib.sh\n@@ -350,17 +350,23 @@ guess_merge_tool () {\n }\n \n get_configured_merge_tool () {\n-\t# Diff mode first tries diff.tool and falls back to merge.tool.\n-\t# Merge mode only checks merge.tool\n+\t# If first argument is true, find the guitool instead\n+\tif test \"$1\" = true\n+\tthen\n+\t\tgui_prefix=gui\n+\tfi\n+\n+\t# Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool.\n+\t# Merge mode only checks merge.(gui)tool\n \tif diff_mode\n \tthen\n-\t\tmerge_tool=$(git config diff.tool || git config merge.tool)\n+\t\tmerge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool)\n \telse\n-\t\tmerge_tool=$(git config merge.tool)\n+\t\tmerge_tool=$(git config merge.${gui_prefix}tool)\n \tfi\n \tif test -n \"$merge_tool\" && ! valid_tool \"$merge_tool\"\n \tthen\n-\t\techo >&2 \"git config option $TOOL_MODE.tool set to unknown tool: $merge_tool\"\n+\t\techo >&2 \"git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool\"\n \t\techo >&2 \"Resetting to default...\"\n \t\treturn 1\n \tfi\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex d07c7f387..01b9ad59b 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -9,7 +9,7 @@\n # at the discretion of Junio C Hamano.\n #\n \n-USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...'\n+USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...'\n SUBDIRECTORY_OK=Yes\n NONGIT_OK=Yes\n OPTIONS_SPEC=\n@@ -389,6 +389,7 @@ print_noop_and_exit () {\n \n main () {\n \tprompt=$(git config --bool mergetool.prompt)\n+\tgui_tool=false\n \tguessed_merge_tool=false\n \torderfile=\n \n@@ -414,6 +415,12 @@ main () {\n \t\t\t\tshift ;;\n \t\t\tesac\n \t\t\t;;\n+\t\t--no-gui)\n+\t\t\tgui_tool=false\n+\t\t\t;;\n+\t\t-g|--gui)\n+\t\t\tgui_tool=true\n+\t\t\t;;\n \t\t-y|--no-prompt)\n \t\t\tprompt=false\n \t\t\t;;\n@@ -443,7 +450,7 @@ main () {\n \tif test -z \"$merge_tool\"\n \tthen\n \t\t# Check if a merge tool has been configured\n-\t\tmerge_tool=$(get_configured_merge_tool)\n+\t\tmerge_tool=$(get_configured_merge_tool $gui_tool)\n \t\t# Try to guess an appropriate merge tool if no tool has been set.\n \t\tif test -z \"$merge_tool\"\n \t\tthen\n-- \n2.19.1\n\n"},{"id":"361601","messageId":"20181026061126.GA7302@archbookpro.localdomain","threadId":"49657","inReplyTo":"cover.1540398076.git.liu.denton@gmail.com","subject":"[RESEND PATCH v3 2/3] completion: support `git mergetool --[no-]gui`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-26T06:11:26Z","receivedAt":"2018-10-26T06:11:31Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Signed-off-by: Denton Liu <liu.denton@gmail.com>\nSigned-off-by: Anmol Mago <anmolmago@gmail.com>\nSigned-off-by: Brian Ho <briankyho@gmail.com>\nSigned-off-by: David Lu <david.lu97@outlook.com>\nSigned-off-by: Ryan Wang <shirui.wang@hotmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex db7fd87b6..a45b4a050 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1833,7 +1833,7 @@ _git_mergetool ()\n \t\treturn\n \t\t;;\n \t--*)\n-\t\t__gitcomp \"--tool= --prompt --no-prompt\"\n+\t\t__gitcomp \"--tool= --prompt --no-prompt --gui --no-gui\"\n \t\treturn\n \t\t;;\n \tesac\n-- \n2.19.1\n\n"},{"id":"361602","messageId":"20181026061134.GA7311@archbookpro.localdomain","threadId":"49657","inReplyTo":"cover.1540398076.git.liu.denton@gmail.com","subject":"[RESEND PATCH v3 3/3] doc: document diff/merge.guitool config keys","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2018-10-26T06:11:34Z","receivedAt":"2018-10-26T06:11:39Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Signed-off-by: Denton Liu <liu.denton@gmail.com>\n---\n Documentation/diff-config.txt  | 8 ++++++++\n Documentation/merge-config.txt | 6 ++++++\n 2 files changed, 14 insertions(+)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 85bca83c3..e64d983c3 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -177,6 +177,14 @@ diff.tool::\n \tAny other value is treated as a custom diff tool and requires\n \tthat a corresponding difftool.<tool>.cmd variable is defined.\n \n+diff.guitool::\n+\tControls which diff tool is used by linkgit:git-difftool[1] when\n+\tthe -g/--gui flag is specified. This variable overrides the value\n+\tconfigured in `merge.guitool`. The list below shows the valid\n+\tbuilt-in values. Any other value is treated as a custom diff tool\n+\tand requires that a corresponding difftool.<guitool>.cmd variable\n+\tis defined.\n+\n include::mergetools-diff.txt[]\n \n diff.indentHeuristic::\ndiff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt\nindex 662c2713c..a7f4ea90c 100644\n--- a/Documentation/merge-config.txt\n+++ b/Documentation/merge-config.txt\n@@ -63,6 +63,12 @@ merge.tool::\n \tAny other value is treated as a custom merge tool and requires\n \tthat a corresponding mergetool.<tool>.cmd variable is defined.\n \n+merge.guitool::\n+\tControls which merge tool is used by linkgit:git-mergetool[1] when the\n+\t-g/--gui flag is specified. The list below shows the valid built-in values.\n+\tAny other value is treated as a custom merge tool and requires that a\n+\tcorresponding mergetool.<guitool>.cmd variable is defined.\n+\n include::mergetools-merge.txt[]\n \n merge.verbosity::\n-- \n2.19.1\n\n"},{"id":"361620","messageId":"xmqqk1m4df2o.fsf@gitster-ct.c.googlers.com","threadId":"49657","inReplyTo":"20181026061111.GA7242@archbookpro.localdomain","subject":"Re: [RESEND PATCH v3 0/3] Add --gui to mergetool","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-10-26T13:15:27Z","receivedAt":"2018-10-26T13:15:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.  \n\nI think this one is identical to what has already been queued and\nnerged to 'next'.\nk\n"}]}