Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2011-12-14 20:54:30 +0400
committerJunio C Hamano <gitster@pobox.com>2011-12-16 01:15:46 +0400
commit0db76962d156c196a23a98014c1585246f561a5d (patch)
tree0967e49d1b767e2446c0f360aa300c0c95954bb3 /builtin/revert.c
parent6bc1a235b1260a8395045261f8004ba9f12677c7 (diff)
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>
Diffstat (limited to 'builtin/revert.c')
-rw-r--r--builtin/revert.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/builtin/revert.c b/builtin/revert.c
index 6d520aee7d..164552e05a 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -719,18 +719,24 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts *
unsigned char commit_sha1[20];
enum replay_action action;
char *end_of_object_name;
- int saved, status;
+ int saved, status, padding;
- if (!prefixcmp(bol, "pick ")) {
+ if (!prefixcmp(bol, "pick")) {
action = CHERRY_PICK;
- bol += strlen("pick ");
- } else if (!prefixcmp(bol, "revert ")) {
+ bol += strlen("pick");
+ } else if (!prefixcmp(bol, "revert")) {
action = REVERT;
- bol += strlen("revert ");
+ bol += strlen("revert");
} else
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;
*end_of_object_name = '\0';
status = get_sha1(bol, commit_sha1);