Re: Git branch outputs usage message on stderr
- From
Jeff King <peff@peff.net>
- Date
- Jan 15, 2025, 22:28 UTC
- Message-ID
- <20250115222840.GB132248@coredump.intra.peff.net>
- In-Reply-To
- <xmqq1px3ybf7.fsf@gitster.g>
On Wed, Jan 15, 2025 at 02:11:56PM -0800, Junio C Hamano wrote:
Show 14 quoted lines
> Jeff King <peff@peff.net> writes: > > > And it uses code 129, even for "-h". I don't see any explicit rationale > > for that in the history; I think it goes back to the beginning of > > parse-options. It happens via the PARSE_OPT_HELP flag, but curiously we > > also trigger that for ambiguous options (which should exit with error). > > That might be a bug-in-waiting if we start handling PARSE_OPT_HELP > > differently. > > There is another class of callers that are protected by the same > "argc == 2 && !strcmp(argv[1], "-h")" condition, and they call > usage.c:usage(), instead of calling usage_with_options(). These > calls (but not all calls to usage()) need to be updated to use a > similar helper, say, show_usage_and_exit_if_asked(). Sigh...
Oof. And that uses vreportf(), which always writes to stderr. So more refactoring.
-Peff