sequencer (rebase -i): skip some revert/cherry-pick specific code path
When a cherry-pick continues without a "todo script", the intention is simply to pick a single commit. However, when an interactive rebase is continued without a "todo script", it means that the last command has been completed and that we now need to clean up. This commit guards the revert/cherry-pick specific steps so that they are not executed in rebase -i mode. 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
4258a6da90988439af1d6008a3172d25efcbf2a1
1 file changed
+14
-12
sequencer.c
+14
-12
@@ -1878,26 +1878,28 @@ int sequencer_continue(struct replay_opts *opts)
1878
if (is_rebase_i(opts)) {
1879
if (commit_staged_changes(opts))
1880
return -1;
1881
- }
1882
- if (!file_exists(get_todo_path(opts)))
1881
+ } else if (!file_exists(get_todo_path(opts)))
1882
return continue_single_pick();
1883
if (read_populate_opts(opts))
1884
return -1;
1885
if ((res = read_populate_todo(&todo_list, opts)))
1886
goto release_todo_list;
1887
1889
- /* Verify that the conflict has been resolved */
1890
- if (file_exists(git_path_cherry_pick_head()) ||
1891
- file_exists(git_path_revert_head())) {
1892
- res = continue_single_pick();
1893
- if (res)
1888
+ if (!is_rebase_i(opts)) {
1889
+ /* Verify that the conflict has been resolved */
1890
+ if (file_exists(git_path_cherry_pick_head()) ||
1891
+ file_exists(git_path_revert_head())) {
1892
+ res = continue_single_pick();
1893
+ if (res)
1894
+ goto release_todo_list;
1895
+ }
1896
+ if (index_differs_from("HEAD", 0, 0)) {
1897
+ res = error_dirty_index(opts);
1898
goto release_todo_list;
1899
+ }
1900
+ todo_list.current++;
1901
}
1896
- if (index_differs_from("HEAD", 0, 0)) {
1897
- res = error_dirty_index(opts);
1898
- goto release_todo_list;
1899
- }
1900
- todo_list.current++;
1902
+
1903
res = pick_commits(&todo_list, opts);
1904
release_todo_list:
1905
todo_list_release(&todo_list);