Re: [PATCH v3 1/8] parseopt: extract subcommand handling from parse_options_step()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 11, 2026, 04:20 UTC
- Message-ID
- <xmqq4imnro8s.fsf@gitster.g>
- In-Reply-To
- <SY0P300MB0801AE08F2AE4C0EAA274A68CE47A@SY0P300MB0801.AUSP300.PROD.OUTLOOK.COM>
Jiamu Sun <39@barroit.sh> writes:
Show 10 quoted lines
> On Tue, Mar 10, 2026 at 05:46:12AM -0700, Karthik Nayak wrote:
>> > + if (ctx->has_subcommands) {
>> > + return handle_subcommand(ctx, arg, options,
>> > + usagestr);
>> > }
>> > +
>>
>> Nit: we try to avoid braces around single statement blocks.
>
> I'm not sure if we should drop the braces in this case.You should.
You can tell that it is a single statement immediately after seeing the beginning of the line, which says "return". It does not matter how many lines the function call that follows "return" spans.