Re: [PATCH] for-each-ref: avoid segfault on --no-format
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 13, 2026, 23:11 UTC
- Message-ID
- <xmqqse148gyf.fsf@gitster.g>
- In-Reply-To
- <xmqqjymg9ycq.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
>> Marking the option with PARSE_OPT_NONEG would also stop the crash, >> but then "--no-format" would work for "git branch" and "git tag" >> and be an error here. > > Shouldn't "git branch --no-format" also error out?
Hmph, "git branch --no-format" seems to take it as an instruction to revert to the default format. Making "--no-format" mean the same thing in "for-each-ref" may make sense.
The implementation of "git branch" side is quite clean; if format.format has a value, use it, or fill it with default. Perhaps mimicking it would give us the right behaviour? I didn't check.