rebase -i: match whole word in is_command()
commit7aed2c0565bb1a7b4524f93e35a29770286ea630
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Thu, 23 Feb 2023 20:55:00 +0000 (23 20:55 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Feb 2023 22:25:48 +0000 (23 14:25 -0800)
tree67068966fb653e0e45ede511e54d1036cdac97c4
parent768bb238c4843bf52847773a621de4dffa6b9ab5
rebase -i: match whole word in is_command()

When matching an unabbreviated command is_command() only does a prefix
match which means it parses "pickled" as TODO_PICK. parse_insn_line()
does error out because is_command() only advances as far as the end of
"pick" so it looks like the command name is not followed by a space but
the error message is "missing arguments for pick" rather than telling
the user that the "pickled" is not a valid command.

Fix this by ensuring the match is follow by whitespace or the end of the
string as we already do for abbreviated commands. The (*bol = p) at the
end of the condition is a bit cute for my taste but I decided to leave
it be for now. Rather than add new tests the existing tests for bad
commands are adapted to use a bad command name that triggers the prefix
matching bug.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
t/lib-rebase.sh
t/t3404-rebase-interactive.sh