git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] completion: Support exclude prefix, ^<rev>
@ 2015-01-29 17:05 Trygve Aaberge
  0 siblings, 0 replies; 2+ messages in thread
From: Trygve Aaberge @ 2015-01-29 17:05 UTC (permalink / raw)
  To: git; +Cc: SZEDER Gábor, Shawn O. Pearce

When using the exclude pattern, ^<rev>, the completion did not work.
This enables completion after ^ in the same way that completion after ..
is done.

Signed-off-by: Trygve Aaberge <trygveaa@gmail.com>
---
 contrib/completion/git-completion.bash | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8cfee95..3036dac 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -496,6 +496,10 @@ __git_complete_revlist_file ()
 		cur_="${cur_#*..}"
 		__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
 		;;
+	^*)
+		cur_="${cur_#^}"
+		__gitcomp_nl "$(__git_refs)" "^" "$cur_"
+		;;
 	*)
 		__gitcomp_nl "$(__git_refs)"
 		;;
-- 
2.2.2

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

* Re: [PATCH] completion: Support exclude prefix, ^<rev>
@ 2015-04-22 13:03 SZEDER Gábor
  0 siblings, 0 replies; 2+ messages in thread
From: SZEDER Gábor @ 2015-04-22 13:03 UTC (permalink / raw)
  To: Trygve Aaberge; +Cc: git, Shawn O. Pearce

Hi,

Quoting Trygve Aaberge <trygveaa@gmail.com>:

> When using the exclude pattern, ^<rev>, the completion did not work.
> This enables completion after ^ in the same way that completion after ..
> is done.

Interesting, thinking back I can't recall I've ever needed multiple  
exclude patterns on the command line, and a single exclude is well  
served by the rev1..rev2 notion.
Of course that doesn't mean that nobody might need it, and since it's  
easy to implement, I'm for it.

> Signed-off-by: Trygve Aaberge <trygveaa@gmail.com>
> ---
> contrib/completion/git-completion.bash | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/contrib/completion/git-completion.bash  
> b/contrib/completion/git-completion.bash
> index 8cfee95..3036dac 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -496,6 +496,10 @@ __git_complete_revlist_file ()
> 		cur_="${cur_#*..}"
> 		__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
> 		;;
> +	^*)
> +		cur_="${cur_#^}"
> +		__gitcomp_nl "$(__git_refs)" "^" "$cur_"
> +		;;

This is good, but considering the other cases I suggest making this  
the very first case.  That way we would not complete e.g. refs after  
'^rev..<TAB>', which would lead to a "bad revision" error when the  
command is executed, or tracked paths after '^rev:<TAB>', which I  
think doesn't make sense, though doesn't lead to error.

> 	*)
> 		__gitcomp_nl "$(__git_refs)"
> 		;;
> --
> 2.2.2

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

end of thread, other threads:[~2015-04-22 13:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-29 17:05 [PATCH] completion: Support exclude prefix, ^<rev> Trygve Aaberge
  -- strict thread matches above, loose matches on Subject: below --
2015-04-22 13:03 SZEDER Gábor

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).