3 test_description='pulling into void'
8 sed -e "$1" <"$2" >"$2.x" &&
14 test_expect_success setup '
18 git commit -a -m original
22 test_expect_success 'pulling into void' '
31 test_expect_success 'checking the results' '
33 test -f cloned/file &&
34 test_cmp file cloned/file
37 test_expect_success 'pulling into void using master:master' '
42 git pull .. master:master
45 test -f cloned-uho/file &&
46 test_cmp file cloned-uho/file
49 test_expect_success 'test . as a remote' '
51 git branch copy master &&
52 git config branch.copy.remote . &&
53 git config branch.copy.merge refs/heads/master &&
55 git commit -a -m updated &&
57 test `cat file` = file &&
59 test `cat file` = updated
62 test_expect_success 'the default remote . should not break explicit pull' '
63 git checkout -b second master^ &&
64 echo modified >file &&
65 git commit -a -m modified &&
67 git reset --hard HEAD^ &&
68 test `cat file` = file &&
70 test `cat file` = modified
73 test_expect_success '--rebase' '
74 git branch to-rebase &&
75 echo modified again > file &&
76 git commit -m file file &&
77 git checkout to-rebase &&
80 git commit -m "new file" &&
81 git tag before-rebase &&
82 git pull --rebase . copy &&
83 test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
84 test new = $(git show HEAD:file2)
87 test_expect_success 'branch.to-rebase.rebase' '
88 git reset --hard before-rebase &&
89 git config branch.to-rebase.rebase 1 &&
91 git config branch.to-rebase.rebase 0 &&
92 test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
93 test new = $(git show HEAD:file2)
96 test_expect_success '--rebase with rebased upstream' '
98 git remote add -f me . &&
101 git reset --hard HEAD^ &&
102 echo conflicting modification > file &&
103 git commit -m conflict file &&
104 git checkout to-rebase &&
106 git commit -m to-rebase file2 &&
107 git tag to-rebase-orig &&
108 git pull --rebase me copy &&
109 test "conflicting modification" = "$(cat file)" &&
110 test file = $(cat file2)
114 test_expect_success '--rebase with rebased default upstream' '
116 git update-ref refs/remotes/me/copy copy-orig &&
117 git checkout --track -b to-rebase2 me/copy &&
118 git reset --hard to-rebase-orig &&
120 test "conflicting modification" = "$(cat file)" &&
121 test file = $(cat file2)
125 test_expect_success 'rebased upstream + fetch + pull --rebase' '
127 git update-ref refs/remotes/me/copy copy-orig &&
128 git reset --hard to-rebase-orig &&
129 git checkout --track -b to-rebase3 me/copy &&
130 git reset --hard to-rebase-orig &&
133 test "conflicting modification" = "$(cat file)" &&
134 test file = "$(cat file2)"
138 test_expect_success 'pull --rebase dies early with dirty working directory' '
140 git checkout to-rebase &&
141 git update-ref refs/remotes/me/copy copy^ &&
142 COPY=$(git rev-parse --verify me/copy) &&
143 git rebase --onto $COPY copy &&
144 git config branch.to-rebase.remote me &&
145 git config branch.to-rebase.merge refs/heads/copy &&
146 git config branch.to-rebase.rebase true &&
147 echo dirty >> file &&
149 test_must_fail git pull &&
150 test $COPY = $(git rev-parse --verify me/copy) &&
151 git checkout HEAD -- file &&
153 test $COPY != $(git rev-parse --verify me/copy)
157 test_expect_success 'pull --rebase works on branch yet to be born' '
158 git rev-parse master >expect &&
162 git pull --rebase .. master &&
163 git rev-parse HEAD >../actual
165 test_cmp expect actual
168 test_expect_success 'setup for detecting upstreamed changes' '
172 printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff &&
174 git commit -m "Initial revision"
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"
184 modify s/5/43/ stuff &&
185 git commit -a -m "Independent discovery of 5->43"
189 test_expect_success 'git pull --rebase detects upstreamed changes' '
192 test -z "$(git ls-files -u)"
196 test_expect_success 'setup for avoiding reapplying old patches' '
198 test_might_fail git rebase --abort &&
199 git reset --hard origin/master
201 git clone --bare src src-replace.git &&
203 mv src-replace.git src &&
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" &&
213 modify s/44/55/ stuff &&
214 git commit --amend -a -m "Modified Change 4"
218 test_expect_success 'git pull --rebase does not reapply old patches' '
220 test_must_fail git pull --rebase &&
221 test 1 = $(find .git/rebase-apply -name "000*" | wc -l)
225 test_expect_success 'git pull --rebase against local branch' '
226 git checkout -b copy2 to-rebase-orig &&
227 git pull --rebase . to-rebase &&
228 test "conflicting modification" = "$(cat file)" &&
229 test file = "$(cat file2)"