On Tue, Dec 13, 2016 at 12:38 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Johannes Schindelin <johannes.schindelin@xxxxxx> 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