Skip to content

Commit f233c9f

Browse files
committed
Merge branch 'sg/assume-no-todo-update-in-cherry-pick'
While running "revert" or "cherry-pick --edit" for multiple commits, a recent regression incorrectly detected "nothing to commit, working tree clean", instead of replaying the commits, which has been corrected. * sg/assume-no-todo-update-in-cherry-pick: sequencer: don't re-read todo for revert and cherry-pick
2 parents ef3ce7c + befd4f6 commit f233c9f

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3930,7 +3930,7 @@ static int pick_commits(struct repository *r,
39303930
item->commit,
39313931
arg, item->arg_len,
39323932
opts, res, 0);
3933-
} else if (check_todo && !res) {
3933+
} else if (is_rebase_i(opts) && check_todo && !res) {
39343934
struct stat st;
39353935

39363936
if (stat(get_todo_path(opts), &st)) {

t/t3429-rebase-edit-todo.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,34 @@ test_expect_success 'todo is re-read after reword and squash' '
5252
test_cmp expected actual
5353
'
5454

55+
test_expect_success 're-reading todo doesnt interfere with revert --edit' '
56+
git reset --hard third &&
57+
58+
git revert --edit third second &&
59+
60+
cat >expect <<-\EOF &&
61+
Revert "second"
62+
Revert "third"
63+
third
64+
second
65+
first
66+
EOF
67+
git log --format="%s" >actual &&
68+
test_cmp expect actual
69+
'
70+
71+
test_expect_success 're-reading todo doesnt interfere with cherry-pick --edit' '
72+
git reset --hard first &&
73+
74+
git cherry-pick --edit second third &&
75+
76+
cat >expect <<-\EOF &&
77+
third
78+
second
79+
first
80+
EOF
81+
git log --format="%s" >actual &&
82+
test_cmp expect actual
83+
'
84+
5585
test_done

0 commit comments

Comments
 (0)