Thread (15 messages) flat view 15 messages, 4 authors, 10d ago

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

From: Junio C Hamano <hidden>
Date: 2026-08-20 21:39:54

"D. Ben Knoble" [off-list ref] writes:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help