sequencer (rebase -i): allow rescheduling commands
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 2 Jan 2017 15:28:34 +0000 (16:28 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Jan 2017 22:57:30 +0000 (14:57 -0800)
The interactive rebase has the very special magic that a cherry-pick
that exits with a status different from 0 and 1 signifies a failure to
even record that a cherry-pick was started.

This can happen e.g. when a fast-forward fails because it would
overwrite untracked files.

In that case, we must reschedule the command that we thought we already
had at least started successfully.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
index 04a64cf0dc00e291b9b4a32054c6aedd1aa6027a..dd5b843a841f6c46bcd44cf5d7a7aa5152fbfef4 100644 (file)
@@ -1915,6 +1915,12 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
                                        1);
                        res = do_pick_commit(item->command, item->commit,
                                        opts, is_final_fixup(todo_list));
+                       if (is_rebase_i(opts) && res < 0) {
+                               /* Reschedule */
+                               todo_list->current--;
+                               if (save_todo(todo_list, opts))
+                                       return -1;
+                       }
                        if (item->command == TODO_EDIT) {
                                struct commit *commit = item->commit;
                                if (!res)