From: Lars Schneider Date: Sun, 06 Nov 2016 14:05:22 GMT Subject: Re: [PATCH v5 08/27] sequencer: completely revamp the "todo" script parsing Message-ID: In-Reply-To: > On 21 Oct 2016, at 14:24, Johannes Schindelin wrote: > > When we came up with the "sequencer" idea, we really wanted to have > kind of a plumbing equivalent of the interactive rebase. Hence the > choice of words: the "todo" script, a "pick", etc. > > ... > > Signed-off-by: Johannes Schindelin > --- > sequencer.c | 284 ++++++++++++++++++++++++++++++++++-------------------------- > 1 file changed, 163 insertions(+), 121 deletions(-) > > diff --git a/sequencer.c b/sequencer.c > index 499f5ee..145de78 100644 > --- a/sequencer.c > +++ b/sequencer.c > @@ -470,7 +470,26 @@ static int allow_empty(struct replay_opts *opts, struct commit *commit) > return 1; > } > > -static int do_pick_commit(struct commit *commit, struct replay_opts *opts) > +enum todo_command { > + TODO_PICK = 0, > + TODO_REVERT > +}; > + > +static const char *todo_command_strings[] = { > + "pick", > + "revert" > +}; > + > +static const char *command_to_string(const enum todo_command command) > +{ > + if (command < ARRAY_SIZE(todo_command_strings)) With DEVELOPER=1 I get this error on macOS when I compile current git/next (b27dc33) using clang: sequencer.c:632:14: error: comparison of constant 2 with expression of type 'const enum todo_command' is always true [-Werror,-Wtautological-constant-out-of-range-compare] if (command < ARRAY_SIZE(todo_command_strings)) Torsten discovered this problem already in v3 and Peff suggested a working solution [1]. Is there any reason not to use Peff's suggestion? Cheers, Lars [1] http://public-inbox.org/git/d9f4f658-94fb-cb9e-7da8-3a2fac120a9e@web.de/