From 850d17b8721caa536138e7a0918b296eb83bf01c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 13 Apr 2016 14:11:54 +0200 Subject: [PATCH] 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 --- sequencer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sequencer.c b/sequencer.c index 59819dc95b..c301253e9b 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1242,8 +1242,7 @@ static int parse_insn_buffer(char *buf, struct todo_list *todo_list) fixup_okay = 1; p = *eol ? eol + 1 : eol; } - if (!todo_list->nr) - return error(_("No commits parsed.")); + return res; } @@ -1267,6 +1266,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;