]> git.ipfire.org Git - thirdparty/git.git/commit - sequencer.c
sequencer: factor out todo command name parsing
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Thu, 27 Jun 2019 14:12:45 +0000 (07:12 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Jun 2019 17:31:01 +0000 (10:31 -0700)
commit3e81bccdf3ceab531e95ba3846083dbc8ba0e319
tree05a4d9947487c880f26a2200791ca45deaddceb4
parentd258dc16c1bf92c01135c38130869da7808ed739
sequencer: factor out todo command name parsing

Factor out the code that parses the name of the command at the start of
each line in the todo file into its own function so that it can be used
in the next commit.

As I don't want to burden other callers with having to pass in a pointer
to the end of the line the test for an abbreviated command is
changed. This change should not affect the behavior. Instead of testing
`eol == bol + 1` the new code checks for the end of the line by testing
for '\n', '\r' or '\0' following the abbreviated name. To avoid reading
past the end of an empty string it also checks that there is actually a
single character abbreviation before testing if it matches. This
prevents it from matching '\0' as the abbreviated name and then trying
to read another character.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c