Subject: Re: [PATCH v2 02/34] sequencer (rebase -i): implement the 'noop' command

From: Junio C Hamano <[email-masked]>
Date: Tue, 13 Dec 2016 13:54:17 -0800

Linus Torvalds <[email-masked]> writes:

> On Tue, Dec 13, 2016 at 12:38 PM, Junio C Hamano <[email-masked]> wrote:
>> Johannes Schindelin <[email-masked]> writes:
>>
>>> +/*
>>> + * Note that ordering matters in this enum. Not only must it match the mapping
>>> + * below, it is also divided into several sections that matter.  When adding
>>> + * new commands, make sure you add it in the right section.
>>> + */
>>
>> Good thinking.  Makes me wish C were a better language, though ;-)
>
> Do this:
>
>   static const char *todo_command_strings[] = {
>       [TODO_PICK] = "pick",
>       [TODO_REVERT] = "revert",
>       [TODO_NOOP] = "noop:,
>   };
>
> which makes the array be order-independent. You still need to make
> sure you fill in all the entries, of course, but it tends to avoid at
> least one gotcha, and it makes it more obvious how the two are tied
> together.
>
>               Linus

Yes, I know.  But I do not think the variant of C we stick to is not
new enough to have that.