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>
Johannes Schindelin committed
Jan 2, 2017 at 16:27 UTC
52865279ee1187a0f630779d2015587ae702b1f4
1 file changed
+5
-2
sequencer.c
+5
-2
@@ -1215,8 +1215,7 @@ static int parse_insn_buffer(char *buf, struct todo_list *todo_list)
1215
else if (!is_noop(item->command))
1216
fixup_okay = 1;
1217
}
1218
- if (!todo_list->nr)
1219
- return error(_("no commits parsed."));
1218
+
1219
return res;
1220
}
1221
@@ -1240,6 +1239,10 @@ static int read_populate_todo(struct todo_list *todo_list,
1239
if (res)
1240
return error(_("unusable instruction sheet: '%s'"), todo_file);
1241
1242
+ if (!todo_list->nr &&
1243
+ (!is_rebase_i(opts) || !file_exists(rebase_path_done())))
1244
+ return error(_("no commits parsed."));
1245
+
1246
if (!is_rebase_i(opts)) {
1247
enum todo_command valid =
1248
opts->action == REPLAY_PICK ? TODO_PICK : TODO_REVERT;