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 &&
32 test_expect_success
'test . as a remote' '
34 git branch copy master &&
35 git config branch.copy.remote . &&
36 git config branch.copy.merge refs/heads/master &&
38 git commit -a -m updated &&
40 test `cat file` = file &&
42 test `cat file` = updated
45 test_expect_success
'the default remote . should not break explicit pull' '
46 git checkout -b second master^ &&
47 echo modified >file &&
48 git commit -a -m modified &&
50 git reset --hard HEAD^ &&
51 test `cat file` = file &&
53 test `cat file` = modified
56 test_expect_success
'--rebase' '
57 git branch to-rebase &&
58 echo modified again > file &&
59 git commit -m file file &&
60 git checkout to-rebase &&
63 git commit -m "new file" &&
64 git tag before-rebase &&
65 git pull --rebase . copy &&
66 test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
67 test new = $(git show HEAD:file2)
70 test_expect_success
'branch.to-rebase.rebase' '
71 git reset --hard before-rebase &&
72 git config branch.to-rebase.rebase 1 &&
74 git config branch.to-rebase.rebase 0 &&
75 test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
76 test new = $(git show HEAD:file2)
79 say
"Remote does not work in t/ - skipping." ||
80 test_expect_success
'--rebase with rebased upstream' '
82 git remote add -f me . &&
84 git reset --hard HEAD^ &&
85 echo conflicting modification > file &&
86 git commit -m conflict file &&
87 git checkout to-rebase &&
89 git commit -m to-rebase file2 &&
90 git pull --rebase me copy &&
91 test "conflicting modification" = "$(cat file)" &&
92 test file = $(cat file2)
96 test_expect_success
'pull --rebase dies early with dirty working directory' '
98 git update-ref refs/remotes/me/copy copy^ &&
99 COPY=$(git rev-parse --verify me/copy) &&
100 git rebase --onto $COPY copy &&
101 git config branch.to-rebase.remote me &&
102 git config branch.to-rebase.merge refs/heads/copy &&
103 git config branch.to-rebase.rebase true &&
104 echo dirty >> file &&
106 test_must_fail git pull &&
107 test $COPY = $(git rev-parse --verify me/copy) &&
108 git checkout HEAD -- file &&
110 test $COPY != $(git rev-parse --verify me/copy)