Our instruction sheet parser first looks for a valid action by checking that the buffer starts with either "pick" or "revert". Then, it looks for either spaces or tabs before looking for the object name, erroring out if it doesn't find any. Simplify this logic without making any functional changes by looking for ("pick " or "pick\t") or ("revert " or "revert\t") in the first place. Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx> --- sequencer.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sequencer.c b/sequencer.c index 458cffb..02e58ad 100644 --- a/sequencer.c +++ b/sequencer.c @@ -517,22 +517,19 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts * { unsigned char commit_sha1[20]; enum replay_action action; - int namelen, padding; + int namelen; - if (!prefixcmp(bol, "pick")) { + if (!prefixcmp(bol, "pick ") || !prefixcmp(bol, "pick\t")) { action = REPLAY_PICK; bol += strlen("pick"); - } else if (!prefixcmp(bol, "revert")) { + } else if (!prefixcmp(bol, "revert ") || !prefixcmp(bol, "revert\t")) { action = REPLAY_REVERT; bol += strlen("revert"); } else return NULL; /* Eat up extra spaces/ tabs before object name */ - padding = strspn(bol, " \t"); - if (!padding) - return NULL; - bol += padding; + bol += strspn(bol, " \t"); /* * Verify that the action matches up with the one in -- 1.7.8.1.362.g5d6df.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html