@matheusbsbs / matheus-bagliano / commits / 3cee92369e
Fork 0

t5520-pull: Add testcases showing spurious conflicts from git pull --rebase

Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Aug 12, 2010 at 19:50 UTC 3cee92369ec8cc908fe3a4307f08cfc22a9ba954
1 file changed +62
t/t5520-pull.sh
+62
@@ -4,6 +4,11 @@ test_description='pulling into void'
4
5 . ./test-lib.sh
6
7 +modify () {
8 + sed -e "$1" <"$2" >"$2.x" &&
9 + mv "$2.x" "$2"
10 +}
11 +
12 D=`pwd`
13
14 test_expect_success setup '
@@ -160,4 +165,61 @@ test_expect_success 'pull --rebase works on branch yet to be born' '
165 test_cmp expect actual
166 '
167
168 +test_expect_success 'setup for detecting upstreamed changes' '
169 + mkdir src &&
170 + (cd src &&
171 + git init &&
172 + printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff &&
173 + git add stuff &&
174 + git commit -m "Initial revision"
175 + ) &&
176 + git clone src dst &&
177 + (cd src &&
178 + modify s/5/43/ stuff &&
179 + git commit -a -m "5->43" &&
180 + modify s/6/42/ stuff &&
181 + git commit -a -m "Make it bigger"
182 + ) &&
183 + (cd dst &&
184 + modify s/5/43/ stuff &&
185 + git commit -a -m "Independent discovery of 5->43"
186 + )
187 +'
188 +
189 +test_expect_failure 'git pull --rebase detects upstreamed changes' '
190 + (cd dst &&
191 + git pull --rebase &&
192 + test -z "$(git ls-files -u)"
193 + )
194 +'
195 +
196 +test_expect_success 'setup for avoiding reapplying old patches' '
197 + (cd dst &&
198 + test_might_fail git rebase --abort &&
199 + git reset --hard origin/master
200 + ) &&
201 + git clone --bare src src-replace.git &&
202 + rm -rf src &&
203 + mv src-replace.git src &&
204 + (cd dst &&
205 + modify s/2/22/ stuff &&
206 + git commit -a -m "Change 2" &&
207 + modify s/3/33/ stuff &&
208 + git commit -a -m "Change 3" &&
209 + modify s/4/44/ stuff &&
210 + git commit -a -m "Change 4" &&
211 + git push &&
212 +
213 + modify s/44/55/ stuff &&
214 + git commit --amend -a -m "Modified Change 4"
215 + )
216 +'
217 +
218 +test_expect_failure 'git pull --rebase does not reapply old patches' '
219 + (cd dst &&
220 + test_must_fail git pull --rebase &&
221 + test 1 = $(find .git/rebase-apply -name "000*" | wc -l)
222 + )
223 +'
224 +
225 test_done