* [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments @ 2018-10-24 2:25 Denton Liu 2018-10-24 5:10 ` Junio C Hamano 0 siblings, 1 reply; 15+ messages in thread From: Denton Liu @ 2018-10-24 2:25 UTC (permalink / raw) To: git; +Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid In line with how difftool accepts a -g/--[no-]gui option, make mergetool accept the same option in order to use the `merge.guitool` variable to find the default mergetool instead of `merge.tool`. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Anmol Mago <anmolmago@gmail.com> Signed-off-by: Brian Ho <briankyho@gmail.com> Signed-off-by: David Lu <david.lu97@outlook.com> Signed-off-by: Ryan Wang <shirui.wang@hotmail.com> --- Documentation/git-mergetool.txt | 11 +++++++++++ git-mergetool--lib.sh | 16 +++++++++++----- git-mergetool.sh | 11 +++++++++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt index 3622d6648..0c7975a05 100644 --- a/Documentation/git-mergetool.txt +++ b/Documentation/git-mergetool.txt @@ -79,6 +79,17 @@ success of the resolution after the custom tool has exited. Prompt before each invocation of the merge resolution program to give the user a chance to skip the path. +-g:: +--gui:: + When 'git-mergetool' is invoked with the `-g` or `--gui` option + the default merge tool will be read from the configured + `merge.guitool` variable instead of `merge.tool`. + +--no-gui:: + This overrides a previous `-g` or `--gui` setting and reads the + default merge tool will be read from the configured `merge.tool` + variable. + -O<orderfile>:: Process files in the order specified in the <orderfile>, which has one shell glob pattern per line. diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 9a8b97a2a..e317ae003 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -350,17 +350,23 @@ guess_merge_tool () { } get_configured_merge_tool () { - # Diff mode first tries diff.tool and falls back to merge.tool. - # Merge mode only checks merge.tool + # If first argument is true, find the guitool instead + if [ "$1" = true ] + then + gui_prefix=gui + fi + + # Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool. + # Merge mode only checks merge.(gui)tool if diff_mode then - merge_tool=$(git config diff.tool || git config merge.tool) + merge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool) else - merge_tool=$(git config merge.tool) + merge_tool=$(git config merge.${gui_prefix}tool) fi if test -n "$merge_tool" && ! valid_tool "$merge_tool" then - echo >&2 "git config option $TOOL_MODE.tool set to unknown tool: $merge_tool" + echo >&2 "git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool" echo >&2 "Resetting to default..." return 1 fi diff --git a/git-mergetool.sh b/git-mergetool.sh index d07c7f387..01b9ad59b 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -9,7 +9,7 @@ # at the discretion of Junio C Hamano. # -USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...' +USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...' SUBDIRECTORY_OK=Yes NONGIT_OK=Yes OPTIONS_SPEC= @@ -389,6 +389,7 @@ print_noop_and_exit () { main () { prompt=$(git config --bool mergetool.prompt) + gui_tool=false guessed_merge_tool=false orderfile= @@ -414,6 +415,12 @@ main () { shift ;; esac ;; + --no-gui) + gui_tool=false + ;; + -g|--gui) + gui_tool=true + ;; -y|--no-prompt) prompt=false ;; @@ -443,7 +450,7 @@ main () { if test -z "$merge_tool" then # Check if a merge tool has been configured - merge_tool=$(get_configured_merge_tool) + merge_tool=$(get_configured_merge_tool $gui_tool) # Try to guess an appropriate merge tool if no tool has been set. if test -z "$merge_tool" then -- 2.19.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments 2018-10-24 2:25 [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments Denton Liu @ 2018-10-24 5:10 ` Junio C Hamano 2018-10-24 5:30 ` Denton Liu ` (3 more replies) 0 siblings, 4 replies; 15+ messages in thread From: Junio C Hamano @ 2018-10-24 5:10 UTC (permalink / raw) To: Denton Liu; +Cc: git, anmolmago, briankyho, david.lu97, shirui.wang, davvid Denton Liu <liu.denton@gmail.com> writes: > Subject: Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments Other people may point it out, but s/Accept/accept/. > In line with how difftool accepts a -g/--[no-]gui option, make mergetool > accept the same option in order to use the `merge.guitool` variable to > find the default mergetool instead of `merge.tool`. > ... > diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh > index 9a8b97a2a..e317ae003 100644 > --- a/git-mergetool--lib.sh > +++ b/git-mergetool--lib.sh > @@ -350,17 +350,23 @@ guess_merge_tool () { > } > > get_configured_merge_tool () { > - # Diff mode first tries diff.tool and falls back to merge.tool. > - # Merge mode only checks merge.tool > + # If first argument is true, find the guitool instead > + if [ "$1" = true ] Don't use [] in our shell script (see Documentation/CodingGuidelines); say if "$1" = true instead. > + then > + gui_prefix=gui > + fi > + > + # Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool. > + # Merge mode only checks merge.(gui)tool > if diff_mode > then > - merge_tool=$(git config diff.tool || git config merge.tool) > + merge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool) > else > - merge_tool=$(git config merge.tool) > + merge_tool=$(git config merge.${gui_prefix}tool) > fi In mode_ok shell function, we seem to be prepared to deal with a case where neither diff_mode nor merge_mode is true. Should this codepath also be prepared to? This is not a comment to point out an issue with this patch. It is a genuine question on the code after (or before for that matter) this patch is applied. Thanks. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments 2018-10-24 5:10 ` Junio C Hamano @ 2018-10-24 5:30 ` Denton Liu 2018-10-24 5:44 ` David Aguilar ` (2 subsequent siblings) 3 siblings, 0 replies; 15+ messages in thread From: Denton Liu @ 2018-10-24 5:30 UTC (permalink / raw) To: Junio C Hamano; +Cc: git, anmolmago, briankyho, david.lu97, shirui.wang, davvid On Wed, Oct 24, 2018 at 02:10:14PM +0900, Junio C Hamano wrote: > In mode_ok shell function, we seem to be prepared to deal with a > case where neither diff_mode nor merge_mode is true. Should this > codepath also be prepared to? > According to Documentation/git-mergetool--lib.txt, >Before sourcing 'git-mergetool{litdd}lib', your script must set `TOOL_MODE` >to define the operation mode for the functions listed below. >'diff' and 'merge' are valid values. so I think that we can assume that the one of diff_mode or merge_mode will return true. In any case, it seems like the rest of the code was written under this assumption so if this needs to be changed then the whole library needs to be fixed as well. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments 2018-10-24 5:10 ` Junio C Hamano 2018-10-24 5:30 ` Denton Liu @ 2018-10-24 5:44 ` David Aguilar 2018-10-24 5:58 ` [PATCH v2 1/2] mergetool: accept " Denton Liu 2018-10-24 5:58 ` [PATCH v2 2/2] completion: support `git mergetool --[no-]gui` Denton Liu 3 siblings, 0 replies; 15+ messages in thread From: David Aguilar @ 2018-10-24 5:44 UTC (permalink / raw) To: Junio C Hamano Cc: Denton Liu, git, anmolmago, briankyho, david.lu97, shirui.wang On Wed, Oct 24, 2018 at 02:10:14PM +0900, Junio C Hamano wrote: > Denton Liu <liu.denton@gmail.com> writes: > > > Subject: Re: [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments > > Other people may point it out, but s/Accept/accept/. > > > In line with how difftool accepts a -g/--[no-]gui option, make mergetool > > accept the same option in order to use the `merge.guitool` variable to > > find the default mergetool instead of `merge.tool`. > > ... > > diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh > > index 9a8b97a2a..e317ae003 100644 > > --- a/git-mergetool--lib.sh > > +++ b/git-mergetool--lib.sh > > @@ -350,17 +350,23 @@ guess_merge_tool () { > > } > > > > get_configured_merge_tool () { > > - # Diff mode first tries diff.tool and falls back to merge.tool. > > - # Merge mode only checks merge.tool > > + # If first argument is true, find the guitool instead > > + if [ "$1" = true ] > > Don't use [] in our shell script (see Documentation/CodingGuidelines); > say > > if "$1" = true > > instead. Perhaps a small typo dropped "test" -- I think it should be if test "$1" = true > > + # Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool. > > + # Merge mode only checks merge.(gui)tool > > if diff_mode > > then > > - merge_tool=$(git config diff.tool || git config merge.tool) > > + merge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool) > > else > > - merge_tool=$(git config merge.tool) > > + merge_tool=$(git config merge.${gui_prefix}tool) > > fi > > In mode_ok shell function, we seem to be prepared to deal with a > case where neither diff_mode nor merge_mode is true. Should this > codepath also be prepared to? > > This is not a comment to point out an issue with this patch. It is > a genuine question on the code after (or before for that matter) > this patch is applied. > > Thanks. I think the code is okay. mode_ok is setup that way to allow filtering for the other mode's tools, but this code path is only concerned with getting the default merge tool, which should only ever happen in one of the two modes. The bit about difftool falling back to mergetool's config is a convenience so it does make sense to keep that for guitool as well. The code after this part should handle merge_tool being empty just fine, so once the `[ ... ]` vs `test` bit is updated, please feel free to add: Acked-by: David Aguilar <davvid@gmail.com> cheers, -- David ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 1/2] mergetool: accept -g/--[no-]gui as arguments 2018-10-24 5:10 ` Junio C Hamano 2018-10-24 5:30 ` Denton Liu 2018-10-24 5:44 ` David Aguilar @ 2018-10-24 5:58 ` Denton Liu 2018-10-24 16:25 ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu 2018-10-24 5:58 ` [PATCH v2 2/2] completion: support `git mergetool --[no-]gui` Denton Liu 3 siblings, 1 reply; 15+ messages in thread From: Denton Liu @ 2018-10-24 5:58 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster In line with how difftool accepts a -g/--[no-]gui option, make mergetool accept the same option in order to use the `merge.guitool` variable to find the default mergetool instead of `merge.tool`. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Anmol Mago <anmolmago@gmail.com> Signed-off-by: Brian Ho <briankyho@gmail.com> Signed-off-by: David Lu <david.lu97@outlook.com> Signed-off-by: Ryan Wang <shirui.wang@hotmail.com> Acked-by: David Aguilar <davvid@gmail.com> --- Documentation/git-mergetool.txt | 11 +++++++++++ git-mergetool--lib.sh | 16 +++++++++++----- git-mergetool.sh | 11 +++++++++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt index 3622d6648..0c7975a05 100644 --- a/Documentation/git-mergetool.txt +++ b/Documentation/git-mergetool.txt @@ -79,6 +79,17 @@ success of the resolution after the custom tool has exited. Prompt before each invocation of the merge resolution program to give the user a chance to skip the path. +-g:: +--gui:: + When 'git-mergetool' is invoked with the `-g` or `--gui` option + the default merge tool will be read from the configured + `merge.guitool` variable instead of `merge.tool`. + +--no-gui:: + This overrides a previous `-g` or `--gui` setting and reads the + default merge tool will be read from the configured `merge.tool` + variable. + -O<orderfile>:: Process files in the order specified in the <orderfile>, which has one shell glob pattern per line. diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 9a8b97a2a..83bf52494 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -350,17 +350,23 @@ guess_merge_tool () { } get_configured_merge_tool () { - # Diff mode first tries diff.tool and falls back to merge.tool. - # Merge mode only checks merge.tool + # If first argument is true, find the guitool instead + if test "$1" = true + then + gui_prefix=gui + fi + + # Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool. + # Merge mode only checks merge.(gui)tool if diff_mode then - merge_tool=$(git config diff.tool || git config merge.tool) + merge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool) else - merge_tool=$(git config merge.tool) + merge_tool=$(git config merge.${gui_prefix}tool) fi if test -n "$merge_tool" && ! valid_tool "$merge_tool" then - echo >&2 "git config option $TOOL_MODE.tool set to unknown tool: $merge_tool" + echo >&2 "git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool" echo >&2 "Resetting to default..." return 1 fi diff --git a/git-mergetool.sh b/git-mergetool.sh index d07c7f387..01b9ad59b 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -9,7 +9,7 @@ # at the discretion of Junio C Hamano. # -USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...' +USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...' SUBDIRECTORY_OK=Yes NONGIT_OK=Yes OPTIONS_SPEC= @@ -389,6 +389,7 @@ print_noop_and_exit () { main () { prompt=$(git config --bool mergetool.prompt) + gui_tool=false guessed_merge_tool=false orderfile= @@ -414,6 +415,12 @@ main () { shift ;; esac ;; + --no-gui) + gui_tool=false + ;; + -g|--gui) + gui_tool=true + ;; -y|--no-prompt) prompt=false ;; @@ -443,7 +450,7 @@ main () { if test -z "$merge_tool" then # Check if a merge tool has been configured - merge_tool=$(get_configured_merge_tool) + merge_tool=$(get_configured_merge_tool $gui_tool) # Try to guess an appropriate merge tool if no tool has been set. if test -z "$merge_tool" then -- 2.19.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 0/3] Add --gui to mergetool 2018-10-24 5:58 ` [PATCH v2 1/2] mergetool: accept " Denton Liu @ 2018-10-24 16:25 ` Denton Liu 2018-10-24 16:25 ` [PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments Denton Liu ` (6 more replies) 0 siblings, 7 replies; 15+ messages in thread From: Denton Liu @ 2018-10-24 16:25 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster This adds another patch on top of the existing patchset in order to document the guitool keys for `git config`. This way, the completions script will now be able to complete these key values as well. Denton Liu (3): mergetool: accept -g/--[no-]gui as arguments completion: support `git mergetool --[no-]gui` doc: document diff/merge.guitool config keys Documentation/diff-config.txt | 8 ++++++++ Documentation/git-mergetool.txt | 11 +++++++++++ Documentation/merge-config.txt | 6 ++++++ contrib/completion/git-completion.bash | 2 +- git-mergetool--lib.sh | 16 +++++++++++----- git-mergetool.sh | 11 +++++++++-- 6 files changed, 46 insertions(+), 8 deletions(-) -- 2.19.1.544.ge0b0585a1.dirty ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments 2018-10-24 16:25 ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu @ 2018-10-24 16:25 ` Denton Liu 2018-10-24 16:25 ` [PATCH v3 2/3] completion: support `git mergetool --[no-]gui` Denton Liu ` (5 subsequent siblings) 6 siblings, 0 replies; 15+ messages in thread From: Denton Liu @ 2018-10-24 16:25 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster In line with how difftool accepts a -g/--[no-]gui option, make mergetool accept the same option in order to use the `merge.guitool` variable to find the default mergetool instead of `merge.tool`. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Anmol Mago <anmolmago@gmail.com> Signed-off-by: Brian Ho <briankyho@gmail.com> Signed-off-by: David Lu <david.lu97@outlook.com> Signed-off-by: Ryan Wang <shirui.wang@hotmail.com> Acked-by: David Aguilar <davvid@gmail.com> --- Documentation/git-mergetool.txt | 11 +++++++++++ git-mergetool--lib.sh | 16 +++++++++++----- git-mergetool.sh | 11 +++++++++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt index 3622d6648..0c7975a05 100644 --- a/Documentation/git-mergetool.txt +++ b/Documentation/git-mergetool.txt @@ -79,6 +79,17 @@ success of the resolution after the custom tool has exited. Prompt before each invocation of the merge resolution program to give the user a chance to skip the path. +-g:: +--gui:: + When 'git-mergetool' is invoked with the `-g` or `--gui` option + the default merge tool will be read from the configured + `merge.guitool` variable instead of `merge.tool`. + +--no-gui:: + This overrides a previous `-g` or `--gui` setting and reads the + default merge tool will be read from the configured `merge.tool` + variable. + -O<orderfile>:: Process files in the order specified in the <orderfile>, which has one shell glob pattern per line. diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 9a8b97a2a..83bf52494 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -350,17 +350,23 @@ guess_merge_tool () { } get_configured_merge_tool () { - # Diff mode first tries diff.tool and falls back to merge.tool. - # Merge mode only checks merge.tool + # If first argument is true, find the guitool instead + if test "$1" = true + then + gui_prefix=gui + fi + + # Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool. + # Merge mode only checks merge.(gui)tool if diff_mode then - merge_tool=$(git config diff.tool || git config merge.tool) + merge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool) else - merge_tool=$(git config merge.tool) + merge_tool=$(git config merge.${gui_prefix}tool) fi if test -n "$merge_tool" && ! valid_tool "$merge_tool" then - echo >&2 "git config option $TOOL_MODE.tool set to unknown tool: $merge_tool" + echo >&2 "git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool" echo >&2 "Resetting to default..." return 1 fi diff --git a/git-mergetool.sh b/git-mergetool.sh index d07c7f387..01b9ad59b 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -9,7 +9,7 @@ # at the discretion of Junio C Hamano. # -USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...' +USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...' SUBDIRECTORY_OK=Yes NONGIT_OK=Yes OPTIONS_SPEC= @@ -389,6 +389,7 @@ print_noop_and_exit () { main () { prompt=$(git config --bool mergetool.prompt) + gui_tool=false guessed_merge_tool=false orderfile= @@ -414,6 +415,12 @@ main () { shift ;; esac ;; + --no-gui) + gui_tool=false + ;; + -g|--gui) + gui_tool=true + ;; -y|--no-prompt) prompt=false ;; @@ -443,7 +450,7 @@ main () { if test -z "$merge_tool" then # Check if a merge tool has been configured - merge_tool=$(get_configured_merge_tool) + merge_tool=$(get_configured_merge_tool $gui_tool) # Try to guess an appropriate merge tool if no tool has been set. if test -z "$merge_tool" then -- 2.19.1.544.ge0b0585a1.dirty ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 2/3] completion: support `git mergetool --[no-]gui` 2018-10-24 16:25 ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu 2018-10-24 16:25 ` [PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments Denton Liu @ 2018-10-24 16:25 ` Denton Liu 2018-10-24 16:25 ` [PATCH v3 3/3] doc: document diff/merge.guitool config keys Denton Liu ` (4 subsequent siblings) 6 siblings, 0 replies; 15+ messages in thread From: Denton Liu @ 2018-10-24 16:25 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Anmol Mago <anmolmago@gmail.com> Signed-off-by: Brian Ho <briankyho@gmail.com> Signed-off-by: David Lu <david.lu97@outlook.com> Signed-off-by: Ryan Wang <shirui.wang@hotmail.com> --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index db7fd87b6..a45b4a050 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1833,7 +1833,7 @@ _git_mergetool () return ;; --*) - __gitcomp "--tool= --prompt --no-prompt" + __gitcomp "--tool= --prompt --no-prompt --gui --no-gui" return ;; esac -- 2.19.1.544.ge0b0585a1.dirty ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 3/3] doc: document diff/merge.guitool config keys 2018-10-24 16:25 ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu 2018-10-24 16:25 ` [PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments Denton Liu 2018-10-24 16:25 ` [PATCH v3 2/3] completion: support `git mergetool --[no-]gui` Denton Liu @ 2018-10-24 16:25 ` Denton Liu 2018-10-26 6:11 ` [RESEND PATCH v3 0/3] Add --gui to mergetool Denton Liu ` (3 subsequent siblings) 6 siblings, 0 replies; 15+ messages in thread From: Denton Liu @ 2018-10-24 16:25 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster Signed-off-by: Denton Liu <liu.denton@gmail.com> --- Documentation/diff-config.txt | 8 ++++++++ Documentation/merge-config.txt | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt index 85bca83c3..e64d983c3 100644 --- a/Documentation/diff-config.txt +++ b/Documentation/diff-config.txt @@ -177,6 +177,14 @@ diff.tool:: Any other value is treated as a custom diff tool and requires that a corresponding difftool.<tool>.cmd variable is defined. +diff.guitool:: + Controls which diff tool is used by linkgit:git-difftool[1] when + the -g/--gui flag is specified. This variable overrides the value + configured in `merge.guitool`. The list below shows the valid + built-in values. Any other value is treated as a custom diff tool + and requires that a corresponding difftool.<guitool>.cmd variable + is defined. + include::mergetools-diff.txt[] diff.indentHeuristic:: diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt index 662c2713c..a7f4ea90c 100644 --- a/Documentation/merge-config.txt +++ b/Documentation/merge-config.txt @@ -63,6 +63,12 @@ merge.tool:: Any other value is treated as a custom merge tool and requires that a corresponding mergetool.<tool>.cmd variable is defined. +merge.guitool:: + Controls which merge tool is used by linkgit:git-mergetool[1] when the + -g/--gui flag is specified. The list below shows the valid built-in values. + Any other value is treated as a custom merge tool and requires that a + corresponding mergetool.<guitool>.cmd variable is defined. + include::mergetools-merge.txt[] merge.verbosity:: -- 2.19.1.544.ge0b0585a1.dirty ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [RESEND PATCH v3 0/3] Add --gui to mergetool 2018-10-24 16:25 ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu ` (2 preceding siblings ...) 2018-10-24 16:25 ` [PATCH v3 3/3] doc: document diff/merge.guitool config keys Denton Liu @ 2018-10-26 6:11 ` Denton Liu 2018-10-26 13:15 ` Junio C Hamano 2018-10-26 6:11 ` [RESEND PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments Denton Liu ` (2 subsequent siblings) 6 siblings, 1 reply; 15+ messages in thread From: Denton Liu @ 2018-10-26 6:11 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster This is a resend of patchset v3 where we add another patch on top of the existing patchset in order to document the guitool keys for `git config`. This way, the completions script will now be able to complete these key values as well. Denton Liu (3): mergetool: accept -g/--[no-]gui as arguments completion: support `git mergetool --[no-]gui` doc: document diff/merge.guitool config keys Documentation/diff-config.txt | 8 ++++++++ Documentation/git-mergetool.txt | 11 +++++++++++ Documentation/merge-config.txt | 6 ++++++ contrib/completion/git-completion.bash | 2 +- git-mergetool--lib.sh | 16 +++++++++++----- git-mergetool.sh | 11 +++++++++-- 6 files changed, 46 insertions(+), 8 deletions(-) -- 2.19.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [RESEND PATCH v3 0/3] Add --gui to mergetool 2018-10-26 6:11 ` [RESEND PATCH v3 0/3] Add --gui to mergetool Denton Liu @ 2018-10-26 13:15 ` Junio C Hamano 0 siblings, 0 replies; 15+ messages in thread From: Junio C Hamano @ 2018-10-26 13:15 UTC (permalink / raw) To: Denton Liu; +Cc: git, anmolmago, briankyho, david.lu97, shirui.wang, davvid Thanks. I think this one is identical to what has already been queued and nerged to 'next'. k ^ permalink raw reply [flat|nested] 15+ messages in thread
* [RESEND PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments 2018-10-24 16:25 ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu ` (3 preceding siblings ...) 2018-10-26 6:11 ` [RESEND PATCH v3 0/3] Add --gui to mergetool Denton Liu @ 2018-10-26 6:11 ` Denton Liu 2018-10-26 6:11 ` [RESEND PATCH v3 2/3] completion: support `git mergetool --[no-]gui` Denton Liu 2018-10-26 6:11 ` [RESEND PATCH v3 3/3] doc: document diff/merge.guitool config keys Denton Liu 6 siblings, 0 replies; 15+ messages in thread From: Denton Liu @ 2018-10-26 6:11 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster In line with how difftool accepts a -g/--[no-]gui option, make mergetool accept the same option in order to use the `merge.guitool` variable to find the default mergetool instead of `merge.tool`. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Anmol Mago <anmolmago@gmail.com> Signed-off-by: Brian Ho <briankyho@gmail.com> Signed-off-by: David Lu <david.lu97@outlook.com> Signed-off-by: Ryan Wang <shirui.wang@hotmail.com> Acked-by: David Aguilar <davvid@gmail.com> --- Documentation/git-mergetool.txt | 11 +++++++++++ git-mergetool--lib.sh | 16 +++++++++++----- git-mergetool.sh | 11 +++++++++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt index 3622d6648..0c7975a05 100644 --- a/Documentation/git-mergetool.txt +++ b/Documentation/git-mergetool.txt @@ -79,6 +79,17 @@ success of the resolution after the custom tool has exited. Prompt before each invocation of the merge resolution program to give the user a chance to skip the path. +-g:: +--gui:: + When 'git-mergetool' is invoked with the `-g` or `--gui` option + the default merge tool will be read from the configured + `merge.guitool` variable instead of `merge.tool`. + +--no-gui:: + This overrides a previous `-g` or `--gui` setting and reads the + default merge tool will be read from the configured `merge.tool` + variable. + -O<orderfile>:: Process files in the order specified in the <orderfile>, which has one shell glob pattern per line. diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 9a8b97a2a..83bf52494 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -350,17 +350,23 @@ guess_merge_tool () { } get_configured_merge_tool () { - # Diff mode first tries diff.tool and falls back to merge.tool. - # Merge mode only checks merge.tool + # If first argument is true, find the guitool instead + if test "$1" = true + then + gui_prefix=gui + fi + + # Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool. + # Merge mode only checks merge.(gui)tool if diff_mode then - merge_tool=$(git config diff.tool || git config merge.tool) + merge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool) else - merge_tool=$(git config merge.tool) + merge_tool=$(git config merge.${gui_prefix}tool) fi if test -n "$merge_tool" && ! valid_tool "$merge_tool" then - echo >&2 "git config option $TOOL_MODE.tool set to unknown tool: $merge_tool" + echo >&2 "git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool" echo >&2 "Resetting to default..." return 1 fi diff --git a/git-mergetool.sh b/git-mergetool.sh index d07c7f387..01b9ad59b 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -9,7 +9,7 @@ # at the discretion of Junio C Hamano. # -USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-O<orderfile>] [file to merge] ...' +USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [-g|--gui|--no-gui] [-O<orderfile>] [file to merge] ...' SUBDIRECTORY_OK=Yes NONGIT_OK=Yes OPTIONS_SPEC= @@ -389,6 +389,7 @@ print_noop_and_exit () { main () { prompt=$(git config --bool mergetool.prompt) + gui_tool=false guessed_merge_tool=false orderfile= @@ -414,6 +415,12 @@ main () { shift ;; esac ;; + --no-gui) + gui_tool=false + ;; + -g|--gui) + gui_tool=true + ;; -y|--no-prompt) prompt=false ;; @@ -443,7 +450,7 @@ main () { if test -z "$merge_tool" then # Check if a merge tool has been configured - merge_tool=$(get_configured_merge_tool) + merge_tool=$(get_configured_merge_tool $gui_tool) # Try to guess an appropriate merge tool if no tool has been set. if test -z "$merge_tool" then -- 2.19.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [RESEND PATCH v3 2/3] completion: support `git mergetool --[no-]gui` 2018-10-24 16:25 ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu ` (4 preceding siblings ...) 2018-10-26 6:11 ` [RESEND PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments Denton Liu @ 2018-10-26 6:11 ` Denton Liu 2018-10-26 6:11 ` [RESEND PATCH v3 3/3] doc: document diff/merge.guitool config keys Denton Liu 6 siblings, 0 replies; 15+ messages in thread From: Denton Liu @ 2018-10-26 6:11 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Anmol Mago <anmolmago@gmail.com> Signed-off-by: Brian Ho <briankyho@gmail.com> Signed-off-by: David Lu <david.lu97@outlook.com> Signed-off-by: Ryan Wang <shirui.wang@hotmail.com> --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index db7fd87b6..a45b4a050 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1833,7 +1833,7 @@ _git_mergetool () return ;; --*) - __gitcomp "--tool= --prompt --no-prompt" + __gitcomp "--tool= --prompt --no-prompt --gui --no-gui" return ;; esac -- 2.19.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [RESEND PATCH v3 3/3] doc: document diff/merge.guitool config keys 2018-10-24 16:25 ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu ` (5 preceding siblings ...) 2018-10-26 6:11 ` [RESEND PATCH v3 2/3] completion: support `git mergetool --[no-]gui` Denton Liu @ 2018-10-26 6:11 ` Denton Liu 6 siblings, 0 replies; 15+ messages in thread From: Denton Liu @ 2018-10-26 6:11 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster Signed-off-by: Denton Liu <liu.denton@gmail.com> --- Documentation/diff-config.txt | 8 ++++++++ Documentation/merge-config.txt | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt index 85bca83c3..e64d983c3 100644 --- a/Documentation/diff-config.txt +++ b/Documentation/diff-config.txt @@ -177,6 +177,14 @@ diff.tool:: Any other value is treated as a custom diff tool and requires that a corresponding difftool.<tool>.cmd variable is defined. +diff.guitool:: + Controls which diff tool is used by linkgit:git-difftool[1] when + the -g/--gui flag is specified. This variable overrides the value + configured in `merge.guitool`. The list below shows the valid + built-in values. Any other value is treated as a custom diff tool + and requires that a corresponding difftool.<guitool>.cmd variable + is defined. + include::mergetools-diff.txt[] diff.indentHeuristic:: diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt index 662c2713c..a7f4ea90c 100644 --- a/Documentation/merge-config.txt +++ b/Documentation/merge-config.txt @@ -63,6 +63,12 @@ merge.tool:: Any other value is treated as a custom merge tool and requires that a corresponding mergetool.<tool>.cmd variable is defined. +merge.guitool:: + Controls which merge tool is used by linkgit:git-mergetool[1] when the + -g/--gui flag is specified. The list below shows the valid built-in values. + Any other value is treated as a custom merge tool and requires that a + corresponding mergetool.<guitool>.cmd variable is defined. + include::mergetools-merge.txt[] merge.verbosity:: -- 2.19.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 2/2] completion: support `git mergetool --[no-]gui` 2018-10-24 5:10 ` Junio C Hamano ` (2 preceding siblings ...) 2018-10-24 5:58 ` [PATCH v2 1/2] mergetool: accept " Denton Liu @ 2018-10-24 5:58 ` Denton Liu 3 siblings, 0 replies; 15+ messages in thread From: Denton Liu @ 2018-10-24 5:58 UTC (permalink / raw) To: git Cc: liu.denton, anmolmago, briankyho, david.lu97, shirui.wang, davvid, gitster Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Anmol Mago <anmolmago@gmail.com> Signed-off-by: Brian Ho <briankyho@gmail.com> Signed-off-by: David Lu <david.lu97@outlook.com> Signed-off-by: Ryan Wang <shirui.wang@hotmail.com> --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index db7fd87b6..a45b4a050 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1833,7 +1833,7 @@ _git_mergetool () return ;; --*) - __gitcomp "--tool= --prompt --no-prompt" + __gitcomp "--tool= --prompt --no-prompt --gui --no-gui" return ;; esac -- 2.19.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
end of thread, other threads:[~2018-10-26 13:15 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-10-24 2:25 [PATCH 1/2] mergetool: Accept -g/--[no-]gui as arguments Denton Liu 2018-10-24 5:10 ` Junio C Hamano 2018-10-24 5:30 ` Denton Liu 2018-10-24 5:44 ` David Aguilar 2018-10-24 5:58 ` [PATCH v2 1/2] mergetool: accept " Denton Liu 2018-10-24 16:25 ` [PATCH v3 0/3] Add --gui to mergetool Denton Liu 2018-10-24 16:25 ` [PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments Denton Liu 2018-10-24 16:25 ` [PATCH v3 2/3] completion: support `git mergetool --[no-]gui` Denton Liu 2018-10-24 16:25 ` [PATCH v3 3/3] doc: document diff/merge.guitool config keys Denton Liu 2018-10-26 6:11 ` [RESEND PATCH v3 0/3] Add --gui to mergetool Denton Liu 2018-10-26 13:15 ` Junio C Hamano 2018-10-26 6:11 ` [RESEND PATCH v3 1/3] mergetool: accept -g/--[no-]gui as arguments Denton Liu 2018-10-26 6:11 ` [RESEND PATCH v3 2/3] completion: support `git mergetool --[no-]gui` Denton Liu 2018-10-26 6:11 ` [RESEND PATCH v3 3/3] doc: document diff/merge.guitool config keys Denton Liu 2018-10-24 5:58 ` [PATCH v2 2/2] completion: support `git mergetool --[no-]gui` Denton Liu
Code repositories for project(s) associated with this public inbox https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).