git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bash completion: merge --abort
@ 2014-05-19  8:36 Haralan Dobrev
  2014-05-22 13:58 ` [PATCH 1/2] completion: add a note that merge options are shared John Keeping
  0 siblings, 1 reply; 4+ messages in thread
From: Haralan Dobrev @ 2014-05-19  8:36 UTC (permalink / raw)
  To: git

Hi all!

The Git Bash completion script does not complete the `--abort` option
for the `merge ` command.

It correctly completes the other flags.
It correctly completes the `--abort` flag for `rebase` and others.

`git merge --abort` is considered another form of the merge command
instead of a simple option.
This could be the cause of the completion to be missed from the script.

Cheers!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] completion: add a note that merge options are shared
  2014-05-19  8:36 Bash completion: merge --abort Haralan Dobrev
@ 2014-05-22 13:58 ` John Keeping
  2014-05-22 13:58   ` [PATCH 2/2] completion: add missing options for git-merge John Keeping
  0 siblings, 1 reply; 4+ messages in thread
From: John Keeping @ 2014-05-22 13:58 UTC (permalink / raw)
  To: git; +Cc: Haralan Dobrev, John Keeping

This should avoid future confusion after a subsequent patch has added
some options to __git_merge_options and some directly in _git_merge().

Signed-off-by: John Keeping <john@keeping.me.uk>
---
 contrib/completion/git-completion.bash | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 2c59a76..ff97c20 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1472,6 +1472,7 @@ _git_log ()
 	__git_complete_revlist
 }
 
+# Common merge options shared by git-merge(1) and git-pull(1).
 __git_merge_options="
 	--no-commit --no-stat --log --no-log --squash --strategy
 	--commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit
-- 
2.0.0.rc2.4.g1dc51c6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] completion: add missing options for git-merge
  2014-05-22 13:58 ` [PATCH 1/2] completion: add a note that merge options are shared John Keeping
@ 2014-05-22 13:58   ` John Keeping
  2014-05-22 23:59     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: John Keeping @ 2014-05-22 13:58 UTC (permalink / raw)
  To: git; +Cc: Haralan Dobrev, John Keeping

The options added to __git_merge_options are those that git-pull also
understands, since that variable is used by both commands.  Those added
directly in _git_merge() are specific to git-merge and are not
supported by git-pull.

Reported-by: Haralan Dobrev <hkdobrev@gmail.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
---
 contrib/completion/git-completion.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ff97c20..019026e 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1476,6 +1476,8 @@ _git_log ()
 __git_merge_options="
 	--no-commit --no-stat --log --no-log --squash --strategy
 	--commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit
+	--verify-signatures --no-verify-signatures --gpg-sign
+	--quiet --verbose --progress --no-progress
 "
 
 _git_merge ()
@@ -1484,7 +1486,8 @@ _git_merge ()
 
 	case "$cur" in
 	--*)
-		__gitcomp "$__git_merge_options"
+		__gitcomp "$__git_merge_options
+			--rerere-autoupdate --no-rerere-autoupdate --abort"
 		return
 	esac
 	__gitcomp_nl "$(__git_refs)"
-- 
2.0.0.rc2.4.g1dc51c6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] completion: add missing options for git-merge
  2014-05-22 13:58   ` [PATCH 2/2] completion: add missing options for git-merge John Keeping
@ 2014-05-22 23:59     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2014-05-22 23:59 UTC (permalink / raw)
  To: John Keeping; +Cc: git, Haralan Dobrev

John Keeping <john@keeping.me.uk> writes:

> The options added to __git_merge_options are those that git-pull also
> understands, since that variable is used by both commands.  Those added
> directly in _git_merge() are specific to git-merge and are not
> supported by git-pull.

Interesting.

Technically, "are not passed through" would be more accurate than
"are not supported", as there may be a very good reason not to call
"git merge --frotz" from "git pull --frotz=nitfol".  In such a case,
"git pull" would _support_ the "--frotz" option, but in a different
way and possibly with semantics different from "git merge --frotz"
(i.e. option with value vs boolean), and completion of the
"--frotz=<value>" option may need to be supported for "git pull"
separately without using $__git_merge_options.

The patch makes us think if "--[no-]rerere-autoupdate" should be a
pass-thru option.  You are unlikely to have seen the same conflict
that will arise from a pull from another person for autoupdate to
matter, but on the other hand, if you do have seen one and resolved
it already, you may want the autoupdate to kick in, so accepting and
passing it through may not be an unreasonable thing to do.

As long as we declare that "git pull --abort" does not make any
sense (which I think is a sane declaration), the distinction you
made in [PATCH 1/2] will always be with us, whether we make
"--rerere-autoupdate" pass-thru or not, so in that sense, both
patches make sense to me.

Thanks.

>
> Reported-by: Haralan Dobrev <hkdobrev@gmail.com>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
>  contrib/completion/git-completion.bash | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index ff97c20..019026e 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1476,6 +1476,8 @@ _git_log ()
>  __git_merge_options="
>  	--no-commit --no-stat --log --no-log --squash --strategy
>  	--commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit
> +	--verify-signatures --no-verify-signatures --gpg-sign
> +	--quiet --verbose --progress --no-progress
>  "
>  
>  _git_merge ()
> @@ -1484,7 +1486,8 @@ _git_merge ()
>  
>  	case "$cur" in
>  	--*)
> -		__gitcomp "$__git_merge_options"
> +		__gitcomp "$__git_merge_options
> +			--rerere-autoupdate --no-rerere-autoupdate --abort"
>  		return
>  	esac
>  	__gitcomp_nl "$(__git_refs)"

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-22 23:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-19  8:36 Bash completion: merge --abort Haralan Dobrev
2014-05-22 13:58 ` [PATCH 1/2] completion: add a note that merge options are shared John Keeping
2014-05-22 13:58   ` [PATCH 2/2] completion: add missing options for git-merge John Keeping
2014-05-22 23:59     ` Junio C Hamano

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 NNTP newsgroup(s).