Subject: Re: [PATCH] git-prompt: fix sequencer/todo detection

From: Junio C Hamano <[email-masked]>
Date: Thu, 07 Apr 2022 15:43:09 -0700

Johannes Schindelin <[email-masked]> writes:

>> > diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
>> > index db7c0068fb..8ae341a306 100644
>> > --- a/contrib/completion/git-prompt.sh
>> > +++ b/contrib/completion/git-prompt.sh
>> > @@ -315,7 +315,7 @@ __git_sequencer_status ()
>> >  	elif __git_eread "$g/sequencer/todo" todo
>> >  	then
>> >  		case "$todo" in
>> > -		p[\ \	]|pick[\ \	]*)
>> > +		p[\ \	]*|pick[\ \	]*)
>> >  			r="|CHERRY-PICKING"
>> >  			return 0
>> >  		;;
>> ...
>
> It looks to me as if the abbreviated commands cannot be generated by Git
> (the `replay_opts` in `builtin/revert.c` are all initialized to
> `REPLAY_OPTS_INIT`, so there is not even any chance of uninitialized data
> there).

Good.  Then the right "fix" would be to drop the misleading "We
would also accept the abbreviated" side of the case arm, instead of
fixing "if we were generating the abbreviated one, here is how we
might support it" code, I guess.

Thanks for sanity-checking my digging in the sequencer.c code.