3 test_description='pulling into void'
9 test_expect_success setup '
13 git commit -a -m original
17 test_expect_success 'pulling into void' '
26 test_expect_success 'checking the results' '
28 test -f cloned/file &&
29 test_cmp file cloned/file
32 test_expect_success 'pulling into void using master:master' '
37 git pull .. master:master
40 test -f cloned-uho/file &&
41 test_cmp file cloned-uho/file
44 test_expect_success 'test . as a remote' '
46 git branch copy master &&
47 git config branch.copy.remote . &&
48 git config branch.copy.merge refs/heads/master &&
50 git commit -a -m updated &&
52 test `cat file` = file &&
54 test `cat file` = updated
57 test_expect_success 'the default remote . should not break explicit pull' '
58 git checkout -b second master^ &&
59 echo modified >file &&
60 git commit -a -m modified &&
62 git reset --hard HEAD^ &&
63 test `cat file` = file &&
65 test `cat file` = modified
68 test_expect_success '--rebase' '
69 git branch to-rebase &&
70 echo modified again > file &&
71 git commit -m file file &&
72 git checkout to-rebase &&
75 git commit -m "new file" &&
76 git tag before-rebase &&
77 git pull --rebase . copy &&
78 test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
79 test new = $(git show HEAD:file2)
82 test_expect_success 'branch.to-rebase.rebase' '
83 git reset --hard before-rebase &&
84 git config branch.to-rebase.rebase 1 &&
86 git config branch.to-rebase.rebase 0 &&
87 test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
88 test new = $(git show HEAD:file2)
91 test_expect_success '--rebase with rebased upstream' '
93 git remote add -f me . &&
96 git reset --hard HEAD^ &&
97 echo conflicting modification > file &&
98 git commit -m conflict file &&
99 git checkout to-rebase &&
101 git commit -m to-rebase file2 &&
102 git tag to-rebase-orig &&
103 git pull --rebase me copy &&
104 test "conflicting modification" = "$(cat file)" &&
105 test file = $(cat file2)
109 test_expect_success '--rebase with rebased default upstream' '
111 git update-ref refs/remotes/me/copy copy-orig &&
112 git checkout --track -b to-rebase2 me/copy &&
113 git reset --hard to-rebase-orig &&
115 test "conflicting modification" = "$(cat file)" &&
116 test file = $(cat file2)
120 test_expect_success 'rebased upstream + fetch + pull --rebase' '
122 git update-ref refs/remotes/me/copy copy-orig &&
123 git reset --hard to-rebase-orig &&
124 git checkout --track -b to-rebase3 me/copy &&
125 git reset --hard to-rebase-orig &&
128 test "conflicting modification" = "$(cat file)" &&
129 test file = "$(cat file2)"
133 test_expect_success 'pull --rebase dies early with dirty working directory' '
135 git checkout to-rebase &&
136 git update-ref refs/remotes/me/copy copy^ &&
137 COPY=$(git rev-parse --verify me/copy) &&
138 git rebase --onto $COPY copy &&
139 git config branch.to-rebase.remote me &&
140 git config branch.to-rebase.merge refs/heads/copy &&
141 git config branch.to-rebase.rebase true &&
142 echo dirty >> file &&
144 test_must_fail git pull &&
145 test $COPY = $(git rev-parse --verify me/copy) &&
146 git checkout HEAD -- file &&
148 test $COPY != $(git rev-parse --verify me/copy)
152 test_expect_success 'pull --rebase works on branch yet to be born' '
153 git rev-parse master >expect &&
157 git pull --rebase .. master &&
158 git rev-parse HEAD >../actual
160 test_cmp expect actual