git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] completion: simplify _git_notes

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Mar 7, 2018, 01:08 UTC
Message-ID
<20180307010843.3503-1-szeder.dev@gmail.com>
In-Reply-To
<xmqqd10g3jxb.fsf@gitster-ct.c.googlers.com>
Show 56 quoted lines
> SZEDER Gábor <szeder.dev@gmail.com> writes:
> 
> > There is a minor behaviour change here, though.  This
> >
> >   prune,*)
> >     ;;
> >
> > case arm ensured that we don't list refs for 'git notes prune <TAB>',
> > because it doesn't accept them (and then we take our usual fallback and
> > let Bash complete filenames;  yeah, 'git notes prune' doesn't accept
> > filenames either, but, as I said, that's our usual fallback when we
> > can't offer anything for completion).
> >
> > This patch removes that case arm, and refs will be offered for 'git
> > notes prune <TAB>'.
> >
> >> +       *,--*)
> >> +               __gitcomp_builtin notes_$subcommand
> >>                 ;;
> >>         *)
> >>                 case "$prev" in
> 
> I have this tentatively queued on the topic.  Can we wrap the topic
> up and move it forward, instead of leaving it (and other topics)
> hanging around and causing conflicts with other topics in flight,
> please?
> 
> Thanks.
> 
> 
> Subject: [PATCH] SQUASH???
> 
> By Szeder <CAM0VKjmmF2t=B2s3rJoKmO3j6Bk5d6PEfCV==ONRGMcdUMLFpQ@mail.gmail.com>
> ---
>  contrib/completion/git-completion.bash | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index ab80f4e6e8..5f7495cda3 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1836,6 +1836,11 @@ _git_notes ()
>  	add,--reedit-message=*|append,--reedit-message=*)
>  		__git_complete_refs --cur="${cur#*=}"
>  		;;
> +	prune,--*)
> +		__gitcomp_builtin notes_prune
> +		;;
> +	prune,*)
> +		;;
>  	*,--*)
>  		__gitcomp_builtin notes_$subcommand
>  		;;
> -- 
> 2.16.2-345-g7e31236f65
> 

That works fine, but this would work just as well and has one less case arm:

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ab80f4e6e8..038af63c1a 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1839,6 +1839,8 @@ _git_notes ()
 	*,--*)
 		__gitcomp_builtin notes_$subcommand
 		;;
+	prune,*)
+		;;
 	*)
 		case "$prev" in
 		-m|-F)
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 15 in “nd/parseopt-completion fixups”
  1. 0/2 nd/parseopt-completion fixupsNguyễn Thái Ngọc Duy, Mar 3, 2018
  2. 1/2 completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdateNguyễn Thái Ngọc Duy, Mar 3, 2018
  3. Eric SunshineMar 3, 2018
  4. Phillip WoodMar 6, 2018
  5. 2/2 completion: simplify _git_notesNguyễn Thái Ngọc Duy, Mar 3, 2018
  6. SZEDER GáborMar 3, 2018
  7. SZEDER GáborMar 3, 2018
  8. Junio C HamanoMar 6, 2018
  9. SZEDER GáborMar 7, 2018
  10. Junio C HamanoMar 7, 2018
  11. 0/4 nd/parseopt-completion fixupsNguyễn Thái Ngọc Duy, Mar 7, 2018
  12. 1/4 completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdateNguyễn Thái Ngọc Duy, Mar 7, 2018
  13. 2/4 completion: simplify _git_notesNguyễn Thái Ngọc Duy, Mar 7, 2018
  14. 3/4 completion: complete --{reuse,reedit}-message= for all notes subcmdsNguyễn Thái Ngọc Duy, Mar 7, 2018
  15. 4/4 completion: more subcommands in _git_notes()Nguyễn Thái Ngọc Duy, Mar 7, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.