On 2026-03-15 at 03:14:47, Jeff King wrote: > So the calling program runs that cat command. And I think what you > really want is to tack "exit 0" onto the end of that output, which would > tell the callers to exit. Something like this: > > diff --git a/parse-options.c b/parse-options.c > index a676da86f5..b990f38419 100644 > --- a/parse-options.c > +++ b/parse-options.c > @@ -1473,8 +1473,10 @@ static enum parse_opt_result usage_with_options_internal(struct parse_opt_ctx_t > } > fputc('\n', outfile); > > - if (!err && ctx && ctx->flags & PARSE_OPT_SHELL_EVAL) > + if (!err && ctx && ctx->flags & PARSE_OPT_SHELL_EVAL) { > fputs("EOF\n", outfile); > + fputs("exit 0\n", outfile); > + } > > return PARSE_OPT_HELP; > } Yeah, I did some poking around, saw the heredoc, and came to the same conclusion that this was a viable solution. Since we both seem to agree that this is a good solution and it also has the advantage of being backward compatible (in that nobody has to change their code to get the new behaviour[0]), this seems like the best option. > And then you don't even need to change the exit code of rev-parse itself > (since we'd never hit the "exit $?" that the caller tacks on in case of > failure). Though I think it might be reasonable to switch it to 0 > anyway. I can do that as well, even though I think that is actually substantially more complicated than the first part. I'll write up a bunch of new tests for these cases in addition. Thanks for a sober second opinion. [0] As we all know, sometimes one has to use older systems and having scripts break on older systems needlessly is quite inconvenient. -- brian m. carlson (they/them) Toronto, Ontario, CA