{"thread":{"id":"45045","subject":"[PATCH] Add --gui option to mergetool","startedAt":"2017-02-04T06:43:16Z","lastAt":"2017-02-05T10:18:35Z","messageCount":2,"participants":["Denton Liu","David Aguilar"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"310837","messageId":"20170204064303.GA14990@arch-attack.localdomain","threadId":"45045","inReplyTo":null,"subject":"[PATCH] Add --gui option to mergetool","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2017-02-04T06:43:03Z","receivedAt":"2017-02-04T06:43:16Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"* fix the discrepancy between difftool and mergetool where\n  the former has the --gui flag and the latter does not by adding the\n  functionality to mergetool\n\n* make difftool read 'merge.guitool' as a fallback, in accordance to the\n  manpage for difftool: \"git difftool falls back to git mergetool\n  config variables when the difftool equivalents have not been defined\"\n\n* add guitool-related completions\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n Documentation/git-difftool.txt         | 3 ++-\n Documentation/git-mergetool.txt        | 8 +++++++-\n contrib/completion/git-completion.bash | 6 ++++--\n git-mergetool.sh                       | 5 ++++-\n 4 files changed, 17 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-difftool.txt b/Documentation/git-difftool.txt\nindex 224fb3090..0b5d29237 100644\n--- a/Documentation/git-difftool.txt\n+++ b/Documentation/git-difftool.txt\n@@ -89,7 +89,8 @@ instead.  `--no-symlinks` is the default on Windows.\n --gui::\n \tWhen 'git-difftool' is invoked with the `-g` or `--gui` option\n \tthe default diff tool will be read from the configured\n-\t`diff.guitool` variable instead of `diff.tool`.\n+\t`diff.guitool` variable instead of `diff.tool`. If `diff.guitool`\n+\tis not defined, it will try and read from `merge.guitool`.\n \n --[no-]trust-exit-code::\n \t'git-difftool' invokes a diff tool individually on each file.\ndiff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt\nindex 3622d6648..2ab56efcf 100644\n--- a/Documentation/git-mergetool.txt\n+++ b/Documentation/git-mergetool.txt\n@@ -8,7 +8,7 @@ git-mergetool - Run merge conflict resolution tools to resolve merge conflicts\n SYNOPSIS\n --------\n [verse]\n-'git mergetool' [--tool=<tool>] [-y | --[no-]prompt] [<file>...]\n+'git mergetool' [--tool=<tool>] [-g|--gui] [-y | --[no-]prompt] [<file>...]\n \n DESCRIPTION\n -----------\n@@ -64,6 +64,12 @@ variable `mergetool.<tool>.trustExitCode` can be set to `true`.\n Otherwise, 'git mergetool' will prompt the user to indicate the\n success of the resolution after the custom tool has exited.\n \n+-g::\n+--gui::\n+\tWhen 'git-mergetool' is invoked with the `-g` or `--gui` option\n+\tthe default diff tool will be read from the configured\n+\t`merge.guitool` variable instead of `merge.tool`.\n+\n --tool-help::\n \tPrint a list of merge tools that may be used with `--tool`.\n \ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 21016bf8d..8a7427f3c 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1268,7 +1268,7 @@ _git_difftool ()\n \t\t\t--base --ours --theirs\n \t\t\t--no-renames --diff-filter= --find-copies-harder\n \t\t\t--relative --ignore-submodules\n-\t\t\t--tool=\"\n+\t\t\t--tool= --gui\"\n \t\treturn\n \t\t;;\n \tesac\n@@ -1566,7 +1566,7 @@ _git_mergetool ()\n \t\treturn\n \t\t;;\n \t--*)\n-\t\t__gitcomp \"--tool=\"\n+\t\t__gitcomp \"--tool= --gui\"\n \t\treturn\n \t\t;;\n \tesac\n@@ -2189,6 +2189,7 @@ _git_config ()\n \t\tdiff.submodule\n \t\tdiff.suppressBlankEmpty\n \t\tdiff.tool\n+\t\tdiff.guitool\n \t\tdiff.wordRegex\n \t\tdiff.algorithm\n \t\tdifftool.\n@@ -2290,6 +2291,7 @@ _git_config ()\n \t\tmerge.renormalize\n \t\tmerge.stat\n \t\tmerge.tool\n+\t\tmerge.guitool\n \t\tmerge.verbosity\n \t\tmergetool.\n \t\tmergetool.keepBackup\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex e52b4e4f2..a17668752 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] [-g|--gui] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...'\n SUBDIRECTORY_OK=Yes\n NONGIT_OK=Yes\n OPTIONS_SPEC=\n@@ -414,6 +414,9 @@ main () {\n \t\t\t\tshift ;;\n \t\t\tesac\n \t\t\t;;\n+\t\t-g|--gui)\n+\t\t\tmerge_tool=$(git config merge.guitool)\n+\t\t\t;;\n \t\t-y|--no-prompt)\n \t\t\tprompt=false\n \t\t\t;;\n-- \n2.11.0.21.ga274e0a.dirty\n\n"},{"id":"310868","messageId":"20170205101825.jdhklpoadt4ingcf@gmail.com","threadId":"45045","inReplyTo":"20170204064303.GA14990@arch-attack.localdomain","subject":"Re: [PATCH] Add --gui option to mergetool","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2017-02-05T10:18:25Z","receivedAt":"2017-02-05T10:18:35Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Fri, Feb 03, 2017 at 10:43:03PM -0800, Denton Liu wrote:\n> * fix the discrepancy between difftool and mergetool where\n>   the former has the --gui flag and the latter does not by adding the\n>   functionality to mergetool\n\nPlease avoid bullet points in commit messages when a simple\nparagraph will suffice.\n\nThe implementation of this feature seems ok, but tests are\nneeded in t/t7610-mergetool.sh.\n\n> * make difftool read 'merge.guitool' as a fallback, in accordance to the\n>   manpage for difftool: \"git difftool falls back to git mergetool\n>   config variables when the difftool equivalents have not been defined\"\n\nI did not spot this change in the code.\n\nNonetheless, this should be split off as a separate patch, and\ntests should be added.\n\n> * add guitool-related completions\n\nThis should be split off as a separate patch as well.\n\nGenerally, 3 bullet points suggests there should be 3 patches in\nthis series.\n\nThanks,\n-- \nDavid\n"}]}