Re: [PATCH 02/11] config-batch: create parse loop and unknown command
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 4, 2026, 23:26 UTC
- Message-ID
- <xmqqv7gcm6p6.fsf@gitster.g>
- In-Reply-To
- <ecd26a0f1fad5615aea07a388e34f02e9f33b870.1770214803.git.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 7 quoted lines
> +static struct command commands[] = {
> + /* unknown_command must be last. */
> + {
> + .name = "",
> + .fn = unknown_command,
> + },
> +};A useful trick is to deliberately omit the trailing comma after the element that MUST be last. You did that for the __NR enum element in a later step.
> +#define COMMAND_COUNT ((size_t)(sizeof(commands) / sizeof(*commands)))
Isn't this ARRAY_SIZE(commands)?
> + while (!(res = process_command(repo)));
Please write an empty statement on its own line, i.e.
while (!(res = process_command(repo))) ;