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

Re: [PATCH 1/4] completion: add missing terminator in case statement

From
John Keeping <john@keeping.me.uk>
Date
Jul 22, 2014, 18:22 UTC
Message-ID
<20140722182207.GC26927@serenity.lan>
In-Reply-To
<xmqqk376iidy.fsf@gitster.dls.corp.google.com>
On Mon, Jul 21, 2014 at 01:09:13PM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > John Keeping <john@keeping.me.uk> writes:
> >
> >> Signed-off-by: John Keeping <john@keeping.me.uk>
> >> ---
> >
> > As these ;; are separators not terminators, this is not strictly
> > necessary.  Squashing it into a change that adds more case arms to
> > this case statement is of course not just good but necessary,
> > though.
> 
> s/necessary/may be &/; if you add new arms before this one, you
> won't need it.  But if you add one after this, you would ;-).
Hmm... POSIX describes them as terminators :-)
	The compound-list for each list of patterns, with the possible
	exception of the last, shall be terminated with ";;".

Although, bash.info is inaccurate here (clearly Bash does implement the POSIX behaviour otherwise the existing code wouldn't work):

	Each clause must be terminated with `;;', `;&', or `;;&'.  The
	WORD undergoes tilde expansion, parameter expansion, command
	substitution, arithmetic expansion, and quote removal before
	matching is attempted.  Each PATTERN undergoes tilde expansion,
	parameter expansion, command substitution, and arithmetic
	expansion.
	There may be an arbitrary number of `case' clauses, each terminated
	by a `;;', `;&', or `;;&'.  The first pattern that matches
	determines the command-list that is executed.
I'll drop this patch in the re-roll since it isn't necessary.
Show 15 quoted lines
> >>  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 7a6e1d7..d0b2895 100644
> >> --- a/contrib/completion/git-completion.bash
> >> +++ b/contrib/completion/git-completion.bash
> >> @@ -1627,6 +1627,7 @@ _git_push ()
> >>  	--repo)
> >>  		__gitcomp_nl "$(__git_remotes)"
> >>  		return
> >> +		;;
> >>  	esac
> >>  	case "$cur" in
> >>  	--repo=*)
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 18 in “completion: add missing terminator in case statement”
  1. 1/4 completion: add missing terminator in case statementJohn Keeping, Jul 19, 2014
  2. 2/4 completion: complete "unstuck" `git push --recurse-submodules`John Keeping, Jul 19, 2014
  3. Johannes SixtJul 19, 2014
  4. John KeepingJul 19, 2014
  5. 3/4 completion: add some missing options to `git push`John Keeping, Jul 19, 2014
  6. 4/4 completion: complete `git push --force-with-lease=`John Keeping, Jul 19, 2014
  7. Junio C HamanoJul 21, 2014
  8. Junio C HamanoJul 21, 2014
  9. John KeepingJul 22, 2014
  10. Junio C HamanoJul 22, 2014
  11. 1/3 completion: complete "unstuck" `git push --recurse-submodules`John Keeping, Jul 22, 2014
  12. 2/3 completion: add some missing options to `git push`John Keeping, Jul 22, 2014
  13. 3/3 completion: complete `git push --force-with-lease=`John Keeping, Jul 22, 2014
  14. Junio C HamanoJul 22, 2014
  15. John KeepingJul 22, 2014
  16. Junio C HamanoJul 22, 2014
  17. John KeepingJul 23, 2014
  18. Junio C HamanoJul 23, 2014

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.