]>
Commit | Line | Data |
---|---|---|
7f87aff2 TA |
1 | #!/bin/sh |
2 | ||
3 | test_description='pull options' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7f87aff2 TA |
7 | test_expect_success 'setup' ' |
8 | mkdir parent && | |
9 | (cd parent && git init && | |
10 | echo one >file && git add file && | |
11 | git commit -m one) | |
12 | ' | |
13 | ||
d18c950a | 14 | test_expect_success 'git pull -q --no-rebase' ' |
7f87aff2 | 15 | mkdir clonedq && |
13e65fe6 | 16 | (cd clonedq && git init && |
d18c950a | 17 | git pull -q --no-rebase "../parent" >out 2>err && |
ca8d148d JH |
18 | test_must_be_empty err && |
19 | test_must_be_empty out) | |
7f87aff2 TA |
20 | ' |
21 | ||
ce4c4d4e PE |
22 | test_expect_success 'git pull -q --rebase' ' |
23 | mkdir clonedqrb && | |
24 | (cd clonedqrb && git init && | |
25 | git pull -q --rebase "../parent" >out 2>err && | |
ca8d148d JH |
26 | test_must_be_empty err && |
27 | test_must_be_empty out && | |
ce4c4d4e | 28 | git pull -q --rebase "../parent" >out 2>err && |
ca8d148d JH |
29 | test_must_be_empty err && |
30 | test_must_be_empty out) | |
ce4c4d4e PE |
31 | ' |
32 | ||
d18c950a | 33 | test_expect_success 'git pull --no-rebase' ' |
7f87aff2 | 34 | mkdir cloned && |
13e65fe6 | 35 | (cd cloned && git init && |
d18c950a | 36 | git pull --no-rebase "../parent" >out 2>err && |
13e65fe6 | 37 | test -s err && |
ca8d148d | 38 | test_must_be_empty out) |
7f87aff2 | 39 | ' |
7f87aff2 | 40 | |
ce4c4d4e PE |
41 | test_expect_success 'git pull --rebase' ' |
42 | mkdir clonedrb && | |
43 | (cd clonedrb && git init && | |
44 | git pull --rebase "../parent" >out 2>err && | |
45 | test -s err && | |
ca8d148d | 46 | test_must_be_empty out) |
ce4c4d4e PE |
47 | ' |
48 | ||
d18c950a | 49 | test_expect_success 'git pull -v --no-rebase' ' |
7f87aff2 | 50 | mkdir clonedv && |
13e65fe6 | 51 | (cd clonedv && git init && |
d18c950a | 52 | git pull -v --no-rebase "../parent" >out 2>err && |
13e65fe6 | 53 | test -s err && |
ca8d148d | 54 | test_must_be_empty out) |
7f87aff2 TA |
55 | ' |
56 | ||
ce4c4d4e PE |
57 | test_expect_success 'git pull -v --rebase' ' |
58 | mkdir clonedvrb && | |
59 | (cd clonedvrb && git init && | |
60 | git pull -v --rebase "../parent" >out 2>err && | |
61 | test -s err && | |
ca8d148d | 62 | test_must_be_empty out) |
ce4c4d4e PE |
63 | ' |
64 | ||
d18c950a | 65 | test_expect_success 'git pull -v -q --no-rebase' ' |
7f87aff2 | 66 | mkdir clonedvq && |
13e65fe6 | 67 | (cd clonedvq && git init && |
d18c950a | 68 | git pull -v -q --no-rebase "../parent" >out 2>err && |
ca8d148d JH |
69 | test_must_be_empty out && |
70 | test_must_be_empty err) | |
7f87aff2 TA |
71 | ' |
72 | ||
d18c950a | 73 | test_expect_success 'git pull -q -v --no-rebase' ' |
7f87aff2 | 74 | mkdir clonedqv && |
13e65fe6 | 75 | (cd clonedqv && git init && |
d18c950a | 76 | git pull -q -v --no-rebase "../parent" >out 2>err && |
ca8d148d | 77 | test_must_be_empty out && |
13e65fe6 | 78 | test -s err) |
7f87aff2 | 79 | ' |
d540b70c DL |
80 | test_expect_success 'git pull --cleanup errors early on invalid argument' ' |
81 | mkdir clonedcleanup && | |
82 | (cd clonedcleanup && git init && | |
d18c950a | 83 | test_must_fail git pull --no-rebase --cleanup invalid "../parent" >out 2>err && |
d540b70c DL |
84 | test_must_be_empty out && |
85 | test -s err) | |
86 | ' | |
87 | ||
7f87aff2 | 88 | |
bba5322a JH |
89 | test_expect_success 'git pull --force' ' |
90 | mkdir clonedoldstyle && | |
91 | (cd clonedoldstyle && git init && | |
92 | cat >>.git/config <<-\EOF && | |
93 | [remote "one"] | |
94 | url = ../parent | |
95 | fetch = refs/heads/master:refs/heads/mirror | |
96 | [remote "two"] | |
97 | url = ../parent | |
98 | fetch = refs/heads/master:refs/heads/origin | |
99 | [branch "master"] | |
100 | remote = two | |
101 | merge = refs/heads/master | |
102 | EOF | |
103 | git pull two && | |
104 | test_commit A && | |
105 | git branch -f origin && | |
106 | git pull --all --force | |
107 | ) | |
108 | ' | |
109 | ||
e6cc5104 JH |
110 | test_expect_success 'git pull --all' ' |
111 | mkdir clonedmulti && | |
112 | (cd clonedmulti && git init && | |
113 | cat >>.git/config <<-\EOF && | |
114 | [remote "one"] | |
115 | url = ../parent | |
116 | fetch = refs/heads/*:refs/remotes/one/* | |
117 | [remote "two"] | |
118 | url = ../parent | |
119 | fetch = refs/heads/*:refs/remotes/two/* | |
120 | [branch "master"] | |
121 | remote = one | |
122 | merge = refs/heads/master | |
123 | EOF | |
124 | git pull --all | |
125 | ) | |
126 | ' | |
127 | ||
5504f13a PT |
128 | test_expect_success 'git pull --dry-run' ' |
129 | test_when_finished "rm -rf clonedry" && | |
130 | git init clonedry && | |
131 | ( | |
132 | cd clonedry && | |
133 | git pull --dry-run ../parent && | |
134 | test_path_is_missing .git/FETCH_HEAD && | |
135 | test_path_is_missing .git/refs/heads/master && | |
136 | test_path_is_missing .git/index && | |
137 | test_path_is_missing file | |
138 | ) | |
139 | ' | |
140 | ||
eb2a8d9e PT |
141 | test_expect_success 'git pull --all --dry-run' ' |
142 | test_when_finished "rm -rf cloneddry" && | |
143 | git init clonedry && | |
144 | ( | |
145 | cd clonedry && | |
146 | git remote add origin ../parent && | |
147 | git pull --all --dry-run && | |
148 | test_path_is_missing .git/FETCH_HEAD && | |
149 | test_path_is_missing .git/refs/remotes/origin/master && | |
150 | test_path_is_missing .git/index && | |
151 | test_path_is_missing file | |
152 | ) | |
153 | ' | |
154 | ||
09c2cb87 JH |
155 | test_expect_success 'git pull --allow-unrelated-histories' ' |
156 | test_when_finished "rm -fr src dst" && | |
157 | git init src && | |
158 | ( | |
159 | cd src && | |
160 | test_commit one && | |
161 | test_commit two | |
162 | ) && | |
163 | git clone src dst && | |
164 | ( | |
165 | cd src && | |
166 | git checkout --orphan side HEAD^ && | |
167 | test_commit three | |
168 | ) && | |
169 | ( | |
170 | cd dst && | |
171 | test_must_fail git pull ../src side && | |
172 | git pull --allow-unrelated-histories ../src side | |
173 | ) | |
174 | ' | |
175 | ||
3a4d2c74 TK |
176 | test_expect_success 'git pull does not add a sign-off line' ' |
177 | test_when_finished "rm -fr src dst actual" && | |
178 | git init src && | |
179 | test_commit -C src one && | |
180 | git clone src dst && | |
181 | test_commit -C src two && | |
182 | git -C dst pull --no-ff && | |
183 | git -C dst show -s --pretty="format:%(trailers)" HEAD >actual && | |
184 | test_must_be_empty actual | |
185 | ' | |
186 | ||
187 | test_expect_success 'git pull --no-signoff does not add sign-off line' ' | |
188 | test_when_finished "rm -fr src dst actual" && | |
189 | git init src && | |
190 | test_commit -C src one && | |
191 | git clone src dst && | |
192 | test_commit -C src two && | |
193 | git -C dst pull --no-signoff --no-ff && | |
194 | git -C dst show -s --pretty="format:%(trailers)" HEAD >actual && | |
195 | test_must_be_empty actual | |
196 | ' | |
197 | ||
198 | test_expect_success 'git pull --signoff add a sign-off line' ' | |
199 | test_when_finished "rm -fr src dst expected actual" && | |
200 | echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >expected && | |
201 | git init src && | |
202 | test_commit -C src one && | |
203 | git clone src dst && | |
204 | test_commit -C src two && | |
205 | git -C dst pull --signoff --no-ff && | |
206 | git -C dst show -s --pretty="format:%(trailers)" HEAD >actual && | |
207 | test_cmp expected actual | |
208 | ' | |
209 | ||
210 | test_expect_success 'git pull --no-signoff flag cancels --signoff flag' ' | |
211 | test_when_finished "rm -fr src dst actual" && | |
212 | git init src && | |
213 | test_commit -C src one && | |
214 | git clone src dst && | |
215 | test_commit -C src two && | |
216 | git -C dst pull --signoff --no-signoff --no-ff && | |
217 | git -C dst show -s --pretty="format:%(trailers)" HEAD >actual && | |
218 | test_must_be_empty actual | |
219 | ' | |
220 | ||
7f87aff2 | 221 | test_done |