revert: tolerate extra spaces, tabs in insn sheet
Tolerate extra spaces and tabs as part of the the field separator in '.git/sequencer/todo', for people with fat fingers. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
6bc1a235b1
commit
0db76962d1
|
@ -719,7 +719,7 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts *
|
||||||
unsigned char commit_sha1[20];
|
unsigned char commit_sha1[20];
|
||||||
enum replay_action action;
|
enum replay_action action;
|
||||||
char *end_of_object_name;
|
char *end_of_object_name;
|
||||||
int saved, status;
|
int saved, status, padding;
|
||||||
|
|
||||||
if (!prefixcmp(bol, "pick")) {
|
if (!prefixcmp(bol, "pick")) {
|
||||||
action = CHERRY_PICK;
|
action = CHERRY_PICK;
|
||||||
|
@ -730,7 +730,13 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts *
|
||||||
} else
|
} else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
end_of_object_name = bol + strcspn(bol, " \n");
|
/* Eat up extra spaces/ tabs before object name */
|
||||||
|
padding = strspn(bol, " \t");
|
||||||
|
if (!padding)
|
||||||
|
return NULL;
|
||||||
|
bol += padding;
|
||||||
|
|
||||||
|
end_of_object_name = bol + strcspn(bol, " \t\n");
|
||||||
saved = *end_of_object_name;
|
saved = *end_of_object_name;
|
||||||
*end_of_object_name = '\0';
|
*end_of_object_name = '\0';
|
||||||
status = get_sha1(bol, commit_sha1);
|
status = get_sha1(bol, commit_sha1);
|
||||||
|
|
|
@ -492,6 +492,17 @@ test_expect_success 'malformed instruction sheet 3' '
|
||||||
test_must_fail git cherry-pick --continue
|
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' '
|
test_expect_success 'commit descriptions in insn sheet are optional' '
|
||||||
pristine_detach initial &&
|
pristine_detach initial &&
|
||||||
test_must_fail git cherry-pick base..anotherpick &&
|
test_must_fail git cherry-pick base..anotherpick &&
|
||||||
|
|
Loading…
Reference in New Issue