Message ID | 20200220214647.451064-1-kolyshkin@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | completion: add diff --color-moved[-ws] | expand |
On Thu, Feb 20, 2020 at 6:47 PM Kir Kolyshkin <kolyshkin@gmail.com> wrote: > > These options are available since git v2.15, but somehow > eluded from the completion script. > > Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> > --- > contrib/completion/git-completion.bash | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > index 1aac5a56c0..43cb6a312d 100644 > --- a/contrib/completion/git-completion.bash > +++ b/contrib/completion/git-completion.bash > @@ -1487,9 +1487,16 @@ __git_diff_algorithms="myers minimal patience histogram" > > __git_diff_submodule_formats="diff log short" > > +__git_color_moved_opts="no default plain blocks zebra dimmed-zebra" > + > +__git_color_moved_ws_opts="no ignore-space-at-eol ignore-all-space > + allow-indentation-change" I think "ignore-space-change" is missing in the above list. Besides that, the patch LGTM. As a side-note: when we have an option with an already filled value, e.g. `--color-moved-ws=allow-identation-change,`, although it accepts more values as a comma separated list, pressing <tab><tab> won't suggest others. But I think the helper functions in git-completion.bash don't provide an easy way to do that right now (and there might even be a bug in bash-completion involving this [1]). So, I think the patch is good as it is (just adding the missing item to that list) :) [1]: https://github.com/scop/bash-completion/issues/240
On Thu, Feb 20, 2020 at 8:30 PM Matheus Tavares Bernardino <matheus.bernardino@usp.br> wrote: > [...] > (and there might even be a bug in bash-completion involving this [1]). Oops, nevermind. I misread the issue, it's a problem with some of bash-completion's pre-shipped completion functions, not regarding the "complete" builtin. Sorry for the noise.
On Thu, 20 Feb 2020 at 15:30, Matheus Tavares Bernardino <matheus.bernardino@usp.br> wrote: > > On Thu, Feb 20, 2020 at 6:47 PM Kir Kolyshkin <kolyshkin@gmail.com> wrote: > > > > These options are available since git v2.15, but somehow > > eluded from the completion script. > > > > Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> > > --- > > contrib/completion/git-completion.bash | 15 +++++++++++++++ > > 1 file changed, 15 insertions(+) > > > > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > > index 1aac5a56c0..43cb6a312d 100644 > > --- a/contrib/completion/git-completion.bash > > +++ b/contrib/completion/git-completion.bash > > @@ -1487,9 +1487,16 @@ __git_diff_algorithms="myers minimal patience histogram" > > > > __git_diff_submodule_formats="diff log short" > > > > +__git_color_moved_opts="no default plain blocks zebra dimmed-zebra" > > + > > +__git_color_moved_ws_opts="no ignore-space-at-eol ignore-all-space > > + allow-indentation-change" > > I think "ignore-space-change" is missing in the above list. Besides > that, the patch LGTM. Thanks for catching this, I'll send v2. > > As a side-note: when we have an option with an already filled value, > e.g. `--color-moved-ws=allow-identation-change,`, although it accepts > more values as a comma separated list, pressing <tab><tab> won't > suggest others. But I think the helper functions in > git-completion.bash don't provide an easy way to do that right now That's right -- as much as I want to make --key=val[,val ...] work, there is no (easy?) way to do that :( > (and there might even be a bug in bash-completion involving this [1]). > So, I think the patch is good as it is (just adding the missing item > to that list) :) > > [1]: https://github.com/scop/bash-completion/issues/240
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1aac5a56c0..43cb6a312d 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1487,9 +1487,16 @@ __git_diff_algorithms="myers minimal patience histogram" __git_diff_submodule_formats="diff log short" +__git_color_moved_opts="no default plain blocks zebra dimmed-zebra" + +__git_color_moved_ws_opts="no ignore-space-at-eol ignore-all-space + allow-indentation-change" + __git_diff_common_options="--stat --numstat --shortstat --summary --patch-with-stat --name-only --name-status --color --no-color --color-words --no-renames --check + --color-moved --color-moved= --no-color-moved + --color-moved-ws= --no-color-moved-ws --full-index --binary --abbrev --diff-filter= --find-copies-harder --ignore-cr-at-eol --text --ignore-space-at-eol --ignore-space-change @@ -1520,6 +1527,14 @@ _git_diff () __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" return ;; + --color-moved=*) + __gitcomp "$__git_color_moved_opts" "" "${cur##--color-moved=}" + return + ;; + --color-moved-ws=*) + __gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}" + return + ;; --*) __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index
These options are available since git v2.15, but somehow eluded from the completion script. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> --- contrib/completion/git-completion.bash | 15 +++++++++++++++ 1 file changed, 15 insertions(+)