Re: [PATCH v2] completion: zsh: support completion after "git -C <path>"
From: D. Ben Knoble <hidden>
Date: 2026-08-21 12:31:57
On Thu, Aug 20, 2026 at 5:39 PM Junio C Hamano [off-list ref] wrote:
"D. Ben Knoble" [off-list ref] writes:quoted
quoted
++ ;; ++ -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.
Oh, thanks! The Bash manual doesn't admit that case in my reading, but it clearly does in implementation. Oddly, I seem to recall several years ago that both Bash and ShellCheck would complain about empty case arms (I got in the habit of writing ": continue" as a bit of a comment). Anyway, TIL. -- D. Ben Knoble