3 test_description='git rebase --continue tests'
7 . "$TEST_DIRECTORY"/lib-rebase.sh
11 test_expect_success 'setup' '
12 test_commit "commit-new-file-F1" F1 1 &&
13 test_commit "commit-new-file-F2" F2 2 &&
15 git checkout -b topic HEAD^ &&
16 test_commit "commit-new-file-F2-on-topic-branch" F2 22 &&
21 test_expect_success 'interactive rebase --continue works with touched file' '
22 rm -fr .git/rebase-* &&
24 git checkout master &&
26 FAKE_LINES="edit 1" git rebase -i HEAD^ &&
27 test-chmtime =-60 F1 &&
31 test_expect_success 'non-interactive rebase --continue works with touched file' '
32 rm -fr .git/rebase-* &&
34 git checkout master &&
36 test_must_fail git rebase --onto master master topic &&
37 echo "Resolved" >F2 &&
39 test-chmtime =-60 F1 &&
43 test_expect_success 'non-interactive rebase --continue with rerere enabled' '
44 test_config rerere.enabled true &&
45 test_when_finished "test_might_fail git rebase --abort" &&
46 git reset --hard commit-new-file-F2-on-topic-branch &&
47 git checkout master &&
48 rm -fr .git/rebase-* &&
50 test_must_fail git rebase --onto master master topic &&
51 echo "Resolved" >F2 &&
54 git rebase --continue &&
56 git reset --hard commit-new-file-F2-on-topic-branch &&
57 git checkout master &&
58 test_must_fail git rebase --onto master master topic &&
59 test_cmp F2.expected F2
62 test_expect_success 'rebase --continue can not be used with other options' '
63 test_must_fail git rebase -v --continue &&
64 test_must_fail git rebase --continue -v
67 test_expect_success 'rebase --continue remembers merge strategy and options' '
68 rm -fr .git/rebase-* &&
69 git reset --hard commit-new-file-F2-on-topic-branch &&
70 test_commit "commit-new-file-F3-on-topic-branch" F3 32 &&
71 test_when_finished "rm -fr test-bin funny.was.run" &&
73 cat >test-bin/git-merge-funny <<-EOF &&
75 case "\$1" in --opt) ;; *) exit 2 ;; esac
78 exec git merge-recursive "\$@"
80 chmod +x test-bin/git-merge-funny &&
83 test_must_fail git rebase -s funny -Xopt master topic
85 test -f funny.was.run &&
87 echo "Resolved" >F2 &&
96 test_expect_success 'rebase --continue remembers --rerere-autoupdate' '
97 rm -fr .git/rebase-* &&
98 git reset --hard commit-new-file-F3-on-topic-branch &&
99 git checkout master &&
100 test_commit "commit-new-file-F3" F3 3 &&
101 git config rerere.enabled true &&
102 test_must_fail git rebase -m master topic &&
103 echo "Resolved" >F2 &&
105 test_must_fail git rebase --continue &&
106 echo "Resolved" >F3 &&
108 git rebase --continue &&
109 git reset --hard topic@{1} &&
110 test_must_fail git rebase -m --rerere-autoupdate master &&
111 test "$(cat F2)" = "Resolved" &&
112 test_must_fail git rebase --continue &&
113 test "$(cat F3)" = "Resolved" &&
114 git rebase --continue