summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-01-02 15:27:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-09 22:57:29 (GMT)
commit52865279ee1187a0f630779d2015587ae702b1f4 (patch)
tree21c07f3bd916c3efd56e8eec7bccdcfc49c71ed9 /sequencer.c
parent4258a6da90988439af1d6008a3172d25efcbf2a1 (diff)
downloadgit-52865279ee1187a0f630779d2015587ae702b1f4.zip
git-52865279ee1187a0f630779d2015587ae702b1f4.tar.gz
git-52865279ee1187a0f630779d2015587ae702b1f4.tar.bz2
sequencer (rebase -i): the todo can be empty when continuing
When the last command of an interactive rebase fails, the user needs to resolve the problem and then continue the interactive rebase. Naturally, the todo script is empty by then. So let's not complain about that! To that end, let's move that test out of the function that parses the todo script, and into the more high-level function read_populate_todo(). This is also necessary by now because the lower-level parse_insn_buffer() has no idea whether we are performing an interactive rebase or not. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c
index a7b9ee0..6a84021 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1215,8 +1215,7 @@ static int parse_insn_buffer(char *buf, struct todo_list *todo_list)
else if (!is_noop(item->command))
fixup_okay = 1;
}
- if (!todo_list->nr)
- return error(_("no commits parsed."));
+
return res;
}
@@ -1240,6 +1239,10 @@ static int read_populate_todo(struct todo_list *todo_list,
if (res)
return error(_("unusable instruction sheet: '%s'"), todo_file);
+ if (!todo_list->nr &&
+ (!is_rebase_i(opts) || !file_exists(rebase_path_done())))
+ return error(_("no commits parsed."));
+
if (!is_rebase_i(opts)) {
enum todo_command valid =
opts->action == REPLAY_PICK ? TODO_PICK : TODO_REVERT;