sequencer (rebase -i): allow rescheduling commands

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>

Johannes Schindelin committed Jan 2, 2017 at 16:28 UTC 9d7bf3cf993ab59e0f9d7150534213f57dd12741
1 file changed +6
sequencer.c
+6
@@ -1915,6 +1915,12 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
1915 1);
1916 res = do_pick_commit(item->command, item->commit,
1917 opts, is_final_fixup(todo_list));
1918 + if (is_rebase_i(opts) && res < 0) {
1919 + /* Reschedule */
1920 + todo_list->current--;
1921 + if (save_todo(todo_list, opts))
1922 + return -1;
1923 + }
1924 if (item->command == TODO_EDIT) {
1925 struct commit *commit = item->commit;
1926 if (!res)