Tolerate extra spaces and tabs as part of the the field separator in '.git/sequencer/todo', for people with fat fingers. Requested-by: Junio C Hamano <gitster@xxxxxxxxx> Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx> --- builtin/revert.c | 6 +++++- t/t3510-cherry-pick-sequence.sh | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/builtin/revert.c b/builtin/revert.c index 70055e5..b976562 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -727,7 +727,11 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts * } else return NULL; - end_of_object_name = bol + strcspn(bol, " \n"); + /* Eat up extra spaces/ tabs before object name */ + while (*bol == ' ' || *bol == '\t') + bol += 1; + + end_of_object_name = bol + strcspn(bol, " \t\n"); saved = *end_of_object_name; *end_of_object_name = '\0'; status = get_sha1(bol, commit_sha1); diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh index 6390f2a..781c5ac 100755 --- a/t/t3510-cherry-pick-sequence.sh +++ b/t/t3510-cherry-pick-sequence.sh @@ -342,6 +342,17 @@ test_expect_success 'malformed instruction sheet 3' ' test_must_fail git cherry-pick --continue ' +test_expect_success 'instruction sheet, fat-fingers version' ' + pristine_detach initial && + test_must_fail git cherry-pick base..anotherpick && + echo "c" >foo && + git add foo && + git commit && + sed "s/pick \([0-9a-f]*\)/pick \1 /" .git/sequencer/todo >new_sheet && + cp new_sheet .git/sequencer/todo && + git cherry-pick --continue +' + test_expect_success 'commit descriptions in insn sheet are optional' ' pristine_detach initial && test_must_fail git cherry-pick base..anotherpick && -- 1.7.7.3 -- 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