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
'rebase --continue can not be used with other options' '
44 test_must_fail git rebase -v --continue &&
45 test_must_fail git rebase --continue -v
48 test_expect_success
'rebase --continue remembers merge strategy and options' '
49 rm -fr .git/rebase-* &&
50 git reset --hard commit-new-file-F2-on-topic-branch &&
51 test_commit "commit-new-file-F3-on-topic-branch" F3 32 &&
52 test_when_finished "rm -fr test-bin funny.was.run" &&
54 cat >test-bin/git-merge-funny <<-EOF &&
56 case "\$1" in --opt) ;; *) exit 2 ;; esac
59 exec git merge-recursive "\$@"
61 chmod +x test-bin/git-merge-funny &&
64 test_must_fail git rebase -s funny -Xopt master topic
66 test -f funny.was.run &&
68 echo "Resolved" >F2 &&
77 test_expect_success
'rebase passes merge strategy options correctly' '
78 rm -fr .git/rebase-* &&
79 git reset --hard commit-new-file-F3-on-topic-branch &&
80 test_commit theirs-to-merge &&
81 git reset --hard HEAD^ &&
82 test_commit some-commit &&
84 git merge --no-ff theirs-to-merge &&
85 FAKE_LINES="1 edit 2 3" git rebase -i -f -p -m \
86 -s recursive --strategy-option=theirs HEAD~2 &&
87 test_commit force-change &&
91 test_expect_failure
'--skip after failed fixup cleans commit message' '
92 test_when_finished "test_might_fail git rebase --abort" &&
93 git checkout -b with-conflicting-fixup &&
94 test_commit wants-fixup &&
95 test_commit "fixup! wants-fixup" wants-fixup.t 1 wants-fixup-1 &&
96 test_commit "fixup! wants-fixup" wants-fixup.t 2 wants-fixup-2 &&
97 test_commit "fixup! wants-fixup" wants-fixup.t 3 wants-fixup-3 &&
98 test_must_fail env FAKE_LINES="1 fixup 2 fixup 4" \
99 git rebase -i HEAD~4 &&
101 : now there is a conflict, and comments in the commit message &&
102 git show HEAD >out &&
103 grep "fixup! wants-fixup" out &&
105 : skip and continue &&
108 : now the comments in the commit message should have been cleaned up &&
109 git show HEAD >out &&
110 ! grep "fixup! wants-fixup" out
113 test_expect_success
'setup rerere database' '
114 rm -fr .git/rebase-* &&
115 git reset --hard commit-new-file-F3-on-topic-branch &&
116 git checkout master &&
117 test_commit "commit-new-file-F3" F3 3 &&
118 test_config rerere.enabled true &&
119 test_must_fail git rebase -m master topic &&
120 echo "Resolved" >F2 &&
123 test_must_fail git rebase --continue &&
124 echo "Resolved" >F3 &&
127 git rebase --continue &&
128 git reset --hard topic@{1}
132 rm -fr .git
/rebase-
* &&
133 git
reset --hard commit-new-file-F3-on-topic-branch
&&
134 git checkout master
&&
135 test_config rerere.enabled true
138 test_rerere_autoupdate
() {
140 test_expect_success
"rebase $action --continue remembers --rerere-autoupdate" '
142 test_must_fail git rebase $action --rerere-autoupdate master topic &&
143 test_cmp expected-F2 F2 &&
144 git diff-files --quiet &&
145 test_must_fail git rebase --continue &&
146 test_cmp expected-F3 F3 &&
147 git diff-files --quiet &&
148 git rebase --continue
151 test_expect_success
"rebase $action --continue honors rerere.autoUpdate" '
153 test_config rerere.autoupdate true &&
154 test_must_fail git rebase $action master topic &&
155 test_cmp expected-F2 F2 &&
156 git diff-files --quiet &&
157 test_must_fail git rebase --continue &&
158 test_cmp expected-F3 F3 &&
159 git diff-files --quiet &&
160 git rebase --continue
163 test_expect_success
"rebase $action --continue remembers --no-rerere-autoupdate" '
165 test_config rerere.autoupdate true &&
166 test_must_fail git rebase $action --no-rerere-autoupdate master topic &&
167 test_cmp expected-F2 F2 &&
168 test_must_fail git diff-files --quiet &&
170 test_must_fail git rebase --continue &&
171 test_cmp expected-F3 F3 &&
172 test_must_fail git diff-files --quiet &&
174 git rebase --continue
178 test_rerere_autoupdate
179 test_rerere_autoupdate
-m
180 GIT_SEQUENCE_EDITOR
=: && export GIT_SEQUENCE_EDITOR
181 test_rerere_autoupdate
-i
182 test_rerere_autoupdate
--preserve-merges