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

Re: [PATCH v2] completion: zsh: support completion after "git -C <path>"

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 20, 2026, 21:39 UTC
Message-ID
<xmqqo6ewtqs8.fsf@gitster.g>
In-Reply-To
<CALnO6CC35iuyJpKZtkEN7fGuGK7zKd_jbebyZdKSQ1pyfOBRZA@mail.gmail.com>
"D. Ben Knoble" <ben.knoble@gmail.com> writes:
Show 10 quoted lines
>>      ++                         ;;
>>      ++                 -c|--git-dir|--work-tree|--namespace)
>>      ++                         (( i++ ))
>>      ++                         ;;
>>      ++                 -*)
>>      ++                         ;;
>
> Yep, unlike Bash (which requires at least one command in the "list"
> part between a pattern and the terminator), Zsh accepts empty actions
> here.
This may be a common misconception.

It is true that a compound_list is not allowed to be empty, but POSIX.1 sh grammar [*] explicitly allows ';;' to come after ')' without a compound_list in between.

Specifically
        case_item        :     pattern ')' linebreak     DSEMI linebreak
                         |     pattern ')' compound_list DSEMI linebreak
                         | '(' pattern ')' linebreak     DSEMI linebreak
                         | '(' pattern ')' compound_list DSEMI linebreak
                         ;
where "linebreak" is a run of NEWLINE tokens or empty.  So
	case $foo in
	bar) ;;
	esac
is allowed.
[Footnote]
* Look for case_clause in
  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
  and read from there.
Previous: D. Ben KnobleNext: D. Ben Knoble
Message 12 of 15 in “completion: zsh: support completion after "git -C <path>"”
  1. completion: zsh: support completion after "git -C <path>"Lutz Lengemann via GitGitGadget, Jun 17, 2026
  2. Ben KnobleJun 17, 2026
  3. Junio C HamanoJun 17, 2026
  4. D. Ben KnobleJun 18, 2026
  5. D. Ben KnobleJul 14, 2026
  6. Lutz LengemannAug 17, 2026
  7. D. Ben KnobleAug 18, 2026
  8. Lutz LengemannAug 18, 2026
  9. D. Ben KnobleAug 18, 2026
  10. completion: zsh: support completion after "git -C <path>"Lutz Lengemann via GitGitGadget, Aug 19, 2026
  11. D. Ben KnobleAug 20, 2026
  12. Junio C HamanoAug 20, 2026
  13. D. Ben KnobleAug 21, 2026
  14. Junio C HamanoAug 21, 2026
  15. Junio C HamanoAug 26, 2026

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.