]>
Commit | Line | Data |
---|---|---|
a3b427b9 AW |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Amos Waterland | |
4 | # | |
5 | ||
c2d17ba3 | 6 | test_description='git branch assorted tests' |
a3b427b9 | 7 | |
a3b427b9 AW |
8 | . ./test-lib.sh |
9 | ||
0d158ebb RR |
10 | test_expect_success 'prepare a trivial repository' ' |
11 | echo Hello >A && | |
12 | git update-index --add A && | |
13 | git commit -m "Initial commit." && | |
14 | echo World >>A && | |
15 | git update-index --add A && | |
16 | git commit -m "Second commit." && | |
140cd845 FC |
17 | HEAD=$(git rev-parse --verify HEAD) |
18 | ' | |
0d158ebb RR |
19 | |
20 | test_expect_success 'git branch --help should not have created a bogus branch' ' | |
01e8d327 | 21 | test_might_fail git branch --man --help </dev/null >/dev/null 2>&1 && |
0d158ebb | 22 | test_path_is_missing .git/refs/heads/--help |
41ac414e | 23 | ' |
a3b427b9 | 24 | |
1dacfbcf NTND |
25 | test_expect_success 'branch -h in broken repository' ' |
26 | mkdir broken && | |
27 | ( | |
28 | cd broken && | |
29 | git init && | |
30 | >.git/refs/heads/master && | |
31 | test_expect_code 129 git branch -h >usage 2>&1 | |
32 | ) && | |
9a001381 | 33 | test_i18ngrep "[Uu]sage" broken/usage |
1dacfbcf NTND |
34 | ' |
35 | ||
0d158ebb RR |
36 | test_expect_success 'git branch abc should create a branch' ' |
37 | git branch abc && test_path_is_file .git/refs/heads/abc | |
38 | ' | |
08db81a9 | 39 | |
0d158ebb RR |
40 | test_expect_success 'git branch a/b/c should create a branch' ' |
41 | git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c | |
42 | ' | |
08db81a9 | 43 | |
0cb24fe8 JH |
44 | test_expect_success 'git branch HEAD should fail' ' |
45 | test_must_fail git branch HEAD | |
46 | ' | |
8efb8899 | 47 | |
d7fb7a37 | 48 | cat >expect <<EOF |
3749fde5 | 49 | $_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master |
d7fb7a37 | 50 | EOF |
0d158ebb RR |
51 | test_expect_success 'git branch -l d/e/f should create a branch and a log' ' |
52 | GIT_COMMITTER_DATE="2005-05-26 23:30" \ | |
53 | git branch -l d/e/f && | |
54 | test_path_is_file .git/refs/heads/d/e/f && | |
55 | test_path_is_file .git/logs/refs/heads/d/e/f && | |
56 | test_cmp expect .git/logs/refs/heads/d/e/f | |
57 | ' | |
58 | ||
59 | test_expect_success 'git branch -d d/e/f should delete a branch and a log' ' | |
60 | git branch -d d/e/f && | |
61 | test_path_is_missing .git/refs/heads/d/e/f && | |
d0ab0584 | 62 | test_must_fail git reflog exists refs/heads/d/e/f |
0d158ebb RR |
63 | ' |
64 | ||
65 | test_expect_success 'git branch j/k should work after branch j has been deleted' ' | |
66 | git branch j && | |
67 | git branch -d j && | |
68 | git branch j/k | |
69 | ' | |
70 | ||
71 | test_expect_success 'git branch l should work after branch l/m has been deleted' ' | |
72 | git branch l/m && | |
73 | git branch -d l/m && | |
74 | git branch l | |
75 | ' | |
76 | ||
77 | test_expect_success 'git branch -m dumps usage' ' | |
78 | test_expect_code 128 git branch -m 2>err && | |
8054b9a6 | 79 | test_i18ngrep "branch name required" err |
0d158ebb RR |
80 | ' |
81 | ||
12fd3496 DT |
82 | test_expect_success 'git branch -m m broken_symref should work' ' |
83 | test_when_finished "git branch -D broken_symref" && | |
84 | git branch -l m && | |
85 | git symbolic-ref refs/heads/broken_symref refs/heads/i_am_broken && | |
86 | git branch -m m broken_symref && | |
87 | git reflog exists refs/heads/broken_symref && | |
88 | test_must_fail git reflog exists refs/heads/i_am_broken | |
89 | ' | |
90 | ||
0d158ebb RR |
91 | test_expect_success 'git branch -m m m/m should work' ' |
92 | git branch -l m && | |
93 | git branch -m m m/m && | |
d0ab0584 | 94 | git reflog exists refs/heads/m/m |
0d158ebb RR |
95 | ' |
96 | ||
97 | test_expect_success 'git branch -m n/n n should work' ' | |
98 | git branch -l n/n && | |
2f139044 | 99 | git branch -m n/n n && |
d0ab0584 | 100 | git reflog exists refs/heads/n |
0d158ebb | 101 | ' |
c976d415 | 102 | |
41ac414e JH |
103 | test_expect_success 'git branch -m o/o o should fail when o/p exists' ' |
104 | git branch o/o && | |
0d158ebb | 105 | git branch o/p && |
d492b31c | 106 | test_must_fail git branch -m o/o o |
41ac414e | 107 | ' |
c976d415 | 108 | |
ff7aa81f MG |
109 | test_expect_success 'git branch -m o/q o/p should fail when o/p exists' ' |
110 | git branch o/q && | |
111 | test_must_fail git branch -m o/q o/p | |
112 | ' | |
113 | ||
114 | test_expect_success 'git branch -M o/q o/p should work when o/p exists' ' | |
115 | git branch -M o/q o/p | |
116 | ' | |
117 | ||
356e91f2 MG |
118 | test_expect_success 'git branch -m -f o/q o/p should work when o/p exists' ' |
119 | git branch o/q && | |
120 | git branch -m -f o/q o/p | |
121 | ' | |
122 | ||
41ac414e JH |
123 | test_expect_success 'git branch -m q r/q should fail when r exists' ' |
124 | git branch q && | |
125 | git branch r && | |
d492b31c | 126 | test_must_fail git branch -m q r/q |
41ac414e | 127 | ' |
c976d415 | 128 | |
55c4a673 CI |
129 | test_expect_success 'git branch -M foo bar should fail when bar is checked out' ' |
130 | git branch bar && | |
131 | git checkout -b foo && | |
132 | test_must_fail git branch -M bar foo | |
133 | ' | |
134 | ||
135 | test_expect_success 'git branch -M baz bam should succeed when baz is checked out' ' | |
136 | git checkout -b baz && | |
137 | git branch bam && | |
70999e9c KY |
138 | git branch -M baz bam && |
139 | test $(git rev-parse --abbrev-ref HEAD) = bam | |
140 | ' | |
141 | ||
893dbf5b KM |
142 | test_expect_success 'git branch -M baz bam should add entry to .git/logs/HEAD' ' |
143 | msg="Branch: renamed refs/heads/baz to refs/heads/bam" && | |
144 | grep " 0\{40\}.*$msg$" .git/logs/HEAD | |
145 | ' | |
146 | ||
70999e9c KY |
147 | test_expect_success 'git branch -M baz bam should succeed when baz is checked out as linked working tree' ' |
148 | git checkout master && | |
149 | git worktree add -b baz bazdir && | |
150 | git worktree add -f bazdir2 baz && | |
151 | git branch -M baz bam && | |
152 | test $(git -C bazdir rev-parse --abbrev-ref HEAD) = bam && | |
153 | test $(git -C bazdir2 rev-parse --abbrev-ref HEAD) = bam | |
154 | ' | |
155 | ||
156 | test_expect_success 'git branch -M baz bam should succeed within a worktree in which baz is checked out' ' | |
157 | git checkout -b baz && | |
158 | git worktree add -f bazdir3 baz && | |
159 | ( | |
160 | cd bazdir3 && | |
161 | git branch -M baz bam && | |
162 | test $(git rev-parse --abbrev-ref HEAD) = bam | |
163 | ) && | |
164 | test $(git rev-parse --abbrev-ref HEAD) = bam | |
55c4a673 CI |
165 | ' |
166 | ||
3f59481e JN |
167 | test_expect_success 'git branch -M master should work when master is checked out' ' |
168 | git checkout master && | |
169 | git branch -M master | |
170 | ' | |
171 | ||
172 | test_expect_success 'git branch -M master master should work when master is checked out' ' | |
173 | git checkout master && | |
174 | git branch -M master master | |
175 | ' | |
176 | ||
177 | test_expect_success 'git branch -M master2 master2 should work when master is checked out' ' | |
178 | git checkout master && | |
179 | git branch master2 && | |
180 | git branch -M master2 master2 | |
181 | ' | |
182 | ||
cddd127b MG |
183 | test_expect_success 'git branch -v -d t should work' ' |
184 | git branch t && | |
376eb14a | 185 | test_path_is_file .git/refs/heads/t && |
cddd127b | 186 | git branch -v -d t && |
376eb14a | 187 | test_path_is_missing .git/refs/heads/t |
cddd127b MG |
188 | ' |
189 | ||
190 | test_expect_success 'git branch -v -m t s should work' ' | |
191 | git branch t && | |
376eb14a | 192 | test_path_is_file .git/refs/heads/t && |
cddd127b | 193 | git branch -v -m t s && |
376eb14a JK |
194 | test_path_is_missing .git/refs/heads/t && |
195 | test_path_is_file .git/refs/heads/s && | |
cddd127b MG |
196 | git branch -d s |
197 | ' | |
198 | ||
199 | test_expect_success 'git branch -m -d t s should fail' ' | |
200 | git branch t && | |
376eb14a | 201 | test_path_is_file .git/refs/heads/t && |
cddd127b MG |
202 | test_must_fail git branch -m -d t s && |
203 | git branch -d t && | |
376eb14a | 204 | test_path_is_missing .git/refs/heads/t |
cddd127b MG |
205 | ' |
206 | ||
207 | test_expect_success 'git branch --list -d t should fail' ' | |
208 | git branch t && | |
376eb14a | 209 | test_path_is_file .git/refs/heads/t && |
cddd127b MG |
210 | test_must_fail git branch --list -d t && |
211 | git branch -d t && | |
376eb14a | 212 | test_path_is_missing .git/refs/heads/t |
cddd127b MG |
213 | ' |
214 | ||
ebe31ef2 NTND |
215 | test_expect_success 'git branch --column' ' |
216 | COLUMNS=81 git branch --column=column >actual && | |
217 | cat >expected <<\EOF && | |
218 | a/b/c bam foo l * master n o/p r | |
219 | abc bar j/k m/m master2 o/o q | |
220 | EOF | |
221 | test_cmp expected actual | |
222 | ' | |
223 | ||
224 | test_expect_success 'git branch --column with an extremely long branch name' ' | |
225 | long=this/is/a/part/of/long/branch/name && | |
226 | long=z$long/$long/$long/$long && | |
227 | test_when_finished "git branch -d $long" && | |
228 | git branch $long && | |
229 | COLUMNS=80 git branch --column=column >actual && | |
230 | cat >expected <<EOF && | |
231 | a/b/c | |
232 | abc | |
233 | bam | |
234 | bar | |
235 | foo | |
236 | j/k | |
237 | l | |
238 | m/m | |
239 | * master | |
240 | master2 | |
241 | n | |
242 | o/o | |
243 | o/p | |
244 | q | |
245 | r | |
246 | $long | |
247 | EOF | |
248 | test_cmp expected actual | |
249 | ' | |
250 | ||
251 | test_expect_success 'git branch with column.*' ' | |
252 | git config column.ui column && | |
253 | git config column.branch "dense" && | |
254 | COLUMNS=80 git branch >actual && | |
255 | git config --unset column.branch && | |
256 | git config --unset column.ui && | |
257 | cat >expected <<\EOF && | |
258 | a/b/c bam foo l * master n o/p r | |
259 | abc bar j/k m/m master2 o/o q | |
260 | EOF | |
261 | test_cmp expected actual | |
262 | ' | |
263 | ||
264 | test_expect_success 'git branch --column -v should fail' ' | |
265 | test_must_fail git branch --column -v | |
266 | ' | |
267 | ||
268 | test_expect_success 'git branch -v with column.ui ignored' ' | |
269 | git config column.ui column && | |
270 | COLUMNS=80 git branch -v | cut -c -10 | sed "s/ *$//" >actual && | |
271 | git config --unset column.ui && | |
272 | cat >expected <<\EOF && | |
273 | a/b/c | |
274 | abc | |
275 | bam | |
276 | bar | |
277 | foo | |
278 | j/k | |
279 | l | |
280 | m/m | |
281 | * master | |
282 | master2 | |
283 | n | |
284 | o/o | |
285 | o/p | |
286 | q | |
287 | r | |
288 | EOF | |
289 | test_cmp expected actual | |
290 | ' | |
291 | ||
01ebb9dc GB |
292 | mv .git/config .git/config-saved |
293 | ||
08b984fb | 294 | test_expect_success 'git branch -m q q2 without config should succeed' ' |
5be60078 JH |
295 | git branch -m q q2 && |
296 | git branch -m q2 q | |
01ebb9dc GB |
297 | ' |
298 | ||
299 | mv .git/config-saved .git/config | |
300 | ||
5be60078 | 301 | git config branch.s/s.dummy Hello |
dc81c58c | 302 | |
0d158ebb RR |
303 | test_expect_success 'git branch -m s/s s should work when s/t is deleted' ' |
304 | git branch -l s/s && | |
d0ab0584 | 305 | git reflog exists refs/heads/s/s && |
0d158ebb | 306 | git branch -l s/t && |
d0ab0584 | 307 | git reflog exists refs/heads/s/t && |
0d158ebb RR |
308 | git branch -d s/t && |
309 | git branch -m s/s s && | |
d0ab0584 | 310 | git reflog exists refs/heads/s |
0d158ebb | 311 | ' |
c976d415 | 312 | |
0d158ebb RR |
313 | test_expect_success 'config information was renamed, too' ' |
314 | test $(git config branch.s.dummy) = Hello && | |
315 | test_must_fail git config branch.s/s/dummy | |
316 | ' | |
dc81c58c | 317 | |
566c7707 RS |
318 | test_expect_success 'deleting a symref' ' |
319 | git branch target && | |
320 | git symbolic-ref refs/heads/symref refs/heads/target && | |
13baa9fe | 321 | echo "Deleted branch symref (was refs/heads/target)." >expect && |
566c7707 RS |
322 | git branch -d symref >actual && |
323 | test_path_is_file .git/refs/heads/target && | |
324 | test_path_is_missing .git/refs/heads/symref && | |
325 | test_i18ncmp expect actual | |
326 | ' | |
327 | ||
0fe700e3 RS |
328 | test_expect_success 'deleting a dangling symref' ' |
329 | git symbolic-ref refs/heads/dangling-symref nowhere && | |
330 | test_path_is_file .git/refs/heads/dangling-symref && | |
13baa9fe | 331 | echo "Deleted branch dangling-symref (was nowhere)." >expect && |
0fe700e3 RS |
332 | git branch -d dangling-symref >actual && |
333 | test_path_is_missing .git/refs/heads/dangling-symref && | |
334 | test_i18ncmp expect actual | |
335 | ' | |
336 | ||
62a2d525 JN |
337 | test_expect_success 'deleting a self-referential symref' ' |
338 | git symbolic-ref refs/heads/self-reference refs/heads/self-reference && | |
339 | test_path_is_file .git/refs/heads/self-reference && | |
340 | echo "Deleted branch self-reference (was refs/heads/self-reference)." >expect && | |
341 | git branch -d self-reference >actual && | |
342 | test_path_is_missing .git/refs/heads/self-reference && | |
343 | test_i18ncmp expect actual | |
344 | ' | |
345 | ||
0d158ebb | 346 | test_expect_success 'renaming a symref is not allowed' ' |
eca35a25 | 347 | git symbolic-ref refs/heads/master2 refs/heads/master && |
fa58186c MV |
348 | test_must_fail git branch -m master2 master3 && |
349 | git symbolic-ref refs/heads/master2 && | |
376eb14a JK |
350 | test_path_is_file .git/refs/heads/master && |
351 | test_path_is_missing .git/refs/heads/master3 | |
eca35a25 MV |
352 | ' |
353 | ||
0d158ebb RR |
354 | test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for u is a symlink' ' |
355 | git branch -l u && | |
356 | mv .git/logs/refs/heads/u real-u && | |
357 | ln -s real-u .git/logs/refs/heads/u && | |
358 | test_must_fail git branch -m u v | |
359 | ' | |
360 | ||
361 | test_expect_success 'test tracking setup via --track' ' | |
362 | git config remote.local.url . && | |
363 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
364 | (git show-ref -q refs/remotes/local/master || git fetch local) && | |
365 | git branch --track my1 local/master && | |
366 | test $(git config branch.my1.remote) = local && | |
367 | test $(git config branch.my1.merge) = refs/heads/master | |
368 | ' | |
369 | ||
370 | test_expect_success 'test tracking setup (non-wildcard, matching)' ' | |
371 | git config remote.local.url . && | |
372 | git config remote.local.fetch refs/heads/master:refs/remotes/local/master && | |
373 | (git show-ref -q refs/remotes/local/master || git fetch local) && | |
374 | git branch --track my4 local/master && | |
375 | test $(git config branch.my4.remote) = local && | |
376 | test $(git config branch.my4.merge) = refs/heads/master | |
377 | ' | |
378 | ||
41c21f22 | 379 | test_expect_success 'tracking setup fails on non-matching refspec' ' |
0d158ebb | 380 | git config remote.local.url . && |
81f339dc | 381 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && |
0d158ebb | 382 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
81f339dc | 383 | git config remote.local.fetch refs/heads/s:refs/remotes/local/s && |
9c9cd39a JH |
384 | test_must_fail git branch --track my5 local/master && |
385 | test_must_fail git config branch.my5.remote && | |
386 | test_must_fail git config branch.my5.merge | |
0d158ebb RR |
387 | ' |
388 | ||
389 | test_expect_success 'test tracking setup via config' ' | |
390 | git config branch.autosetupmerge true && | |
391 | git config remote.local.url . && | |
392 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
393 | (git show-ref -q refs/remotes/local/master || git fetch local) && | |
394 | git branch my3 local/master && | |
395 | test $(git config branch.my3.remote) = local && | |
396 | test $(git config branch.my3.merge) = refs/heads/master | |
397 | ' | |
398 | ||
399 | test_expect_success 'test overriding tracking setup via --no-track' ' | |
400 | git config branch.autosetupmerge true && | |
401 | git config remote.local.url . && | |
402 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
403 | (git show-ref -q refs/remotes/local/master || git fetch local) && | |
404 | git branch --no-track my2 local/master && | |
405 | git config branch.autosetupmerge false && | |
406 | ! test "$(git config branch.my2.remote)" = local && | |
407 | ! test "$(git config branch.my2.merge)" = refs/heads/master | |
408 | ' | |
409 | ||
410 | test_expect_success 'no tracking without .fetch entries' ' | |
411 | git config branch.autosetupmerge true && | |
412 | git branch my6 s && | |
002ba037 | 413 | git config branch.autosetupmerge false && |
0d158ebb RR |
414 | test -z "$(git config branch.my6.remote)" && |
415 | test -z "$(git config branch.my6.merge)" | |
416 | ' | |
417 | ||
418 | test_expect_success 'test tracking setup via --track but deeper' ' | |
419 | git config remote.local.url . && | |
420 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
421 | (git show-ref -q refs/remotes/local/o/o || git fetch local) && | |
422 | git branch --track my7 local/o/o && | |
423 | test "$(git config branch.my7.remote)" = local && | |
424 | test "$(git config branch.my7.merge)" = refs/heads/o/o | |
425 | ' | |
426 | ||
427 | test_expect_success 'test deleting branch deletes branch config' ' | |
428 | git branch -d my7 && | |
429 | test -z "$(git config branch.my7.remote)" && | |
430 | test -z "$(git config branch.my7.merge)" | |
431 | ' | |
432 | ||
433 | test_expect_success 'test deleting branch without config' ' | |
434 | git branch my7 s && | |
435 | sha1=$(git rev-parse my7 | cut -c 1-7) && | |
436 | echo "Deleted branch my7 (was $sha1)." >expect && | |
437 | git branch -d my7 >actual 2>&1 && | |
438 | test_i18ncmp expect actual | |
439 | ' | |
440 | ||
f292244c KY |
441 | test_expect_success 'deleting currently checked out branch fails' ' |
442 | git worktree add -b my7 my7 && | |
443 | test_must_fail git -C my7 branch -d my7 && | |
444 | test_must_fail git branch -d my7 | |
445 | ' | |
446 | ||
0d158ebb RR |
447 | test_expect_success 'test --track without .fetch entries' ' |
448 | git branch --track my8 && | |
449 | test "$(git config branch.my8.remote)" && | |
450 | test "$(git config branch.my8.merge)" | |
451 | ' | |
452 | ||
453 | test_expect_success 'branch from non-branch HEAD w/autosetupmerge=always' ' | |
454 | git config branch.autosetupmerge always && | |
455 | git branch my9 HEAD^ && | |
456 | git config branch.autosetupmerge false | |
457 | ' | |
458 | ||
459 | test_expect_success 'branch from non-branch HEAD w/--track causes failure' ' | |
460 | test_must_fail git branch --track my10 HEAD^ | |
461 | ' | |
462 | ||
463 | test_expect_success 'branch from tag w/--track causes failure' ' | |
464 | git tag foobar && | |
465 | test_must_fail git branch --track my11 foobar | |
466 | ' | |
467 | ||
0cb24fe8 JH |
468 | test_expect_success '--set-upstream-to fails on multiple branches' ' |
469 | test_must_fail git branch --set-upstream-to master a b c | |
470 | ' | |
471 | ||
472 | test_expect_success '--set-upstream-to fails on detached HEAD' ' | |
473 | git checkout HEAD^{} && | |
474 | test_must_fail git branch --set-upstream-to master && | |
475 | git checkout - | |
476 | ' | |
477 | ||
8a3e5ecd JK |
478 | test_expect_success '--set-upstream-to fails on a missing dst branch' ' |
479 | test_must_fail git branch --set-upstream-to master does-not-exist | |
480 | ' | |
481 | ||
482 | test_expect_success '--set-upstream-to fails on a missing src branch' ' | |
483 | test_must_fail git branch --set-upstream-to does-not-exist master | |
484 | ' | |
485 | ||
486 | test_expect_success '--set-upstream-to fails on a non-ref' ' | |
487 | test_must_fail git branch --set-upstream-to HEAD^{} | |
488 | ' | |
489 | ||
27852b2c PS |
490 | test_expect_success '--set-upstream-to fails on locked config' ' |
491 | test_when_finished "rm -f .git/config.lock" && | |
492 | >.git/config.lock && | |
493 | git branch locked && | |
494 | test_must_fail git branch --set-upstream-to locked | |
495 | ' | |
496 | ||
0d158ebb RR |
497 | test_expect_success 'use --set-upstream-to modify HEAD' ' |
498 | test_config branch.master.remote foo && | |
499 | test_config branch.master.merge foo && | |
d0423ddd | 500 | git branch my12 && |
0d158ebb RR |
501 | git branch --set-upstream-to my12 && |
502 | test "$(git config branch.master.remote)" = "." && | |
503 | test "$(git config branch.master.merge)" = "refs/heads/my12" | |
504 | ' | |
505 | ||
506 | test_expect_success 'use --set-upstream-to modify a particular branch' ' | |
d0423ddd | 507 | git branch my13 && |
0d158ebb RR |
508 | git branch --set-upstream-to master my13 && |
509 | test "$(git config branch.my13.remote)" = "." && | |
510 | test "$(git config branch.my13.merge)" = "refs/heads/master" | |
511 | ' | |
512 | ||
513 | test_expect_success '--unset-upstream should fail if given a non-existent branch' ' | |
514 | test_must_fail git branch --unset-upstream i-dont-exist | |
515 | ' | |
516 | ||
b81842cb PS |
517 | test_expect_success '--unset-upstream should fail if config is locked' ' |
518 | test_when_finished "rm -f .git/config.lock" && | |
519 | git branch --set-upstream-to locked && | |
520 | >.git/config.lock && | |
521 | test_must_fail git branch --unset-upstream | |
522 | ' | |
523 | ||
0d158ebb | 524 | test_expect_success 'test --unset-upstream on HEAD' ' |
d0423ddd | 525 | git branch my14 && |
0d158ebb RR |
526 | test_config branch.master.remote foo && |
527 | test_config branch.master.merge foo && | |
528 | git branch --set-upstream-to my14 && | |
529 | git branch --unset-upstream && | |
530 | test_must_fail git config branch.master.remote && | |
531 | test_must_fail git config branch.master.merge && | |
532 | # fail for a branch without upstream set | |
533 | test_must_fail git branch --unset-upstream | |
534 | ' | |
535 | ||
0cb24fe8 JH |
536 | test_expect_success '--unset-upstream should fail on multiple branches' ' |
537 | test_must_fail git branch --unset-upstream a b c | |
538 | ' | |
539 | ||
540 | test_expect_success '--unset-upstream should fail on detached HEAD' ' | |
541 | git checkout HEAD^{} && | |
542 | test_must_fail git branch --unset-upstream && | |
543 | git checkout - | |
544 | ' | |
545 | ||
0d158ebb | 546 | test_expect_success 'test --unset-upstream on a particular branch' ' |
d0423ddd | 547 | git branch my15 && |
0d158ebb RR |
548 | git branch --set-upstream-to master my14 && |
549 | git branch --unset-upstream my14 && | |
550 | test_must_fail git config branch.my14.remote && | |
551 | test_must_fail git config branch.my14.merge | |
552 | ' | |
553 | ||
554 | test_expect_success '--set-upstream shows message when creating a new branch that exists as remote-tracking' ' | |
555 | git update-ref refs/remotes/origin/master HEAD && | |
556 | git branch --set-upstream origin/master 2>actual && | |
557 | test_when_finished git update-ref -d refs/remotes/origin/master && | |
558 | test_when_finished git branch -d origin/master && | |
559 | cat >expected <<EOF && | |
b347d06b CMN |
560 | The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to |
561 | ||
562 | If you wanted to make '"'master'"' track '"'origin/master'"', do this: | |
563 | ||
564 | git branch -d origin/master | |
565 | git branch --set-upstream-to origin/master | |
566 | EOF | |
1edbaac3 | 567 | test_i18ncmp expected actual |
b347d06b CMN |
568 | ' |
569 | ||
0d158ebb RR |
570 | test_expect_success '--set-upstream with two args only shows the deprecation message' ' |
571 | git branch --set-upstream master my13 2>actual && | |
572 | test_when_finished git branch --unset-upstream master && | |
573 | cat >expected <<EOF && | |
b347d06b CMN |
574 | The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to |
575 | EOF | |
1edbaac3 | 576 | test_i18ncmp expected actual |
b347d06b CMN |
577 | ' |
578 | ||
0d158ebb RR |
579 | test_expect_success '--set-upstream with one arg only shows the deprecation message if the branch existed' ' |
580 | git branch --set-upstream my13 2>actual && | |
581 | test_when_finished git branch --unset-upstream my13 && | |
582 | cat >expected <<EOF && | |
b347d06b CMN |
583 | The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to |
584 | EOF | |
1edbaac3 | 585 | test_i18ncmp expected actual |
b347d06b CMN |
586 | ' |
587 | ||
95052d1f BG |
588 | test_expect_success '--set-upstream-to notices an error to set branch as own upstream' ' |
589 | git branch --set-upstream-to refs/heads/my13 my13 2>actual && | |
590 | cat >expected <<-\EOF && | |
591 | warning: Not setting branch my13 as its own upstream. | |
592 | EOF | |
593 | test_expect_code 1 git config branch.my13.remote && | |
594 | test_expect_code 1 git config branch.my13.merge && | |
595 | test_i18ncmp expected actual | |
596 | ' | |
597 | ||
0746d19a PB |
598 | # Keep this test last, as it changes the current branch |
599 | cat >expect <<EOF | |
3749fde5 | 600 | $_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master |
0746d19a | 601 | EOF |
0d158ebb RR |
602 | test_expect_success 'git checkout -b g/h/i -l should create a branch and a log' ' |
603 | GIT_COMMITTER_DATE="2005-05-26 23:30" \ | |
604 | git checkout -b g/h/i -l master && | |
605 | test_path_is_file .git/refs/heads/g/h/i && | |
606 | test_path_is_file .git/logs/refs/heads/g/h/i && | |
607 | test_cmp expect .git/logs/refs/heads/g/h/i | |
608 | ' | |
0746d19a | 609 | |
b2099957 EM |
610 | test_expect_success 'checkout -b makes reflog by default' ' |
611 | git checkout master && | |
612 | git config --unset core.logAllRefUpdates && | |
613 | git checkout -b alpha && | |
6e6842e3 | 614 | git rev-parse --verify alpha@{0} |
b2099957 EM |
615 | ' |
616 | ||
617 | test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' ' | |
618 | git checkout master && | |
619 | git config core.logAllRefUpdates false && | |
620 | git checkout -b beta && | |
6e6842e3 | 621 | test_must_fail git rev-parse --verify beta@{0} |
b2099957 EM |
622 | ' |
623 | ||
624 | test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' ' | |
625 | git checkout master && | |
626 | git checkout -lb gamma && | |
627 | git config --unset core.logAllRefUpdates && | |
6e6842e3 | 628 | git rev-parse --verify gamma@{0} |
b2099957 EM |
629 | ' |
630 | ||
1d0a694b DB |
631 | test_expect_success 'avoid ambiguous track' ' |
632 | git config branch.autosetupmerge true && | |
633 | git config remote.ambi1.url lalala && | |
634 | git config remote.ambi1.fetch refs/heads/lalala:refs/heads/master && | |
635 | git config remote.ambi2.url lilili && | |
636 | git config remote.ambi2.fetch refs/heads/lilili:refs/heads/master && | |
27852b2c | 637 | test_must_fail git branch all1 master && |
1d0a694b DB |
638 | test -z "$(git config branch.all1.merge)" |
639 | ' | |
640 | ||
c998ae9b DS |
641 | test_expect_success 'autosetuprebase local on a tracked local branch' ' |
642 | git config remote.local.url . && | |
643 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
644 | git config branch.autosetuprebase local && | |
0cb0e143 | 645 | (git show-ref -q refs/remotes/local/o || git fetch local) && |
c998ae9b DS |
646 | git branch mybase && |
647 | git branch --track myr1 mybase && | |
648 | test "$(git config branch.myr1.remote)" = . && | |
649 | test "$(git config branch.myr1.merge)" = refs/heads/mybase && | |
650 | test "$(git config branch.myr1.rebase)" = true | |
651 | ' | |
652 | ||
653 | test_expect_success 'autosetuprebase always on a tracked local branch' ' | |
654 | git config remote.local.url . && | |
655 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
656 | git config branch.autosetuprebase always && | |
0cb0e143 | 657 | (git show-ref -q refs/remotes/local/o || git fetch local) && |
c998ae9b DS |
658 | git branch mybase2 && |
659 | git branch --track myr2 mybase && | |
660 | test "$(git config branch.myr2.remote)" = . && | |
661 | test "$(git config branch.myr2.merge)" = refs/heads/mybase && | |
662 | test "$(git config branch.myr2.rebase)" = true | |
663 | ' | |
664 | ||
665 | test_expect_success 'autosetuprebase remote on a tracked local branch' ' | |
666 | git config remote.local.url . && | |
667 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
668 | git config branch.autosetuprebase remote && | |
0cb0e143 | 669 | (git show-ref -q refs/remotes/local/o || git fetch local) && |
c998ae9b DS |
670 | git branch mybase3 && |
671 | git branch --track myr3 mybase2 && | |
672 | test "$(git config branch.myr3.remote)" = . && | |
673 | test "$(git config branch.myr3.merge)" = refs/heads/mybase2 && | |
674 | ! test "$(git config branch.myr3.rebase)" = true | |
675 | ' | |
676 | ||
677 | test_expect_success 'autosetuprebase never on a tracked local branch' ' | |
678 | git config remote.local.url . && | |
679 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
680 | git config branch.autosetuprebase never && | |
0cb0e143 | 681 | (git show-ref -q refs/remotes/local/o || git fetch local) && |
c998ae9b DS |
682 | git branch mybase4 && |
683 | git branch --track myr4 mybase2 && | |
684 | test "$(git config branch.myr4.remote)" = . && | |
685 | test "$(git config branch.myr4.merge)" = refs/heads/mybase2 && | |
686 | ! test "$(git config branch.myr4.rebase)" = true | |
687 | ' | |
688 | ||
689 | test_expect_success 'autosetuprebase local on a tracked remote branch' ' | |
690 | git config remote.local.url . && | |
691 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
692 | git config branch.autosetuprebase local && | |
0cb0e143 | 693 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
694 | git branch --track myr5 local/master && |
695 | test "$(git config branch.myr5.remote)" = local && | |
696 | test "$(git config branch.myr5.merge)" = refs/heads/master && | |
697 | ! test "$(git config branch.myr5.rebase)" = true | |
698 | ' | |
699 | ||
700 | test_expect_success 'autosetuprebase never on a tracked remote branch' ' | |
701 | git config remote.local.url . && | |
702 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
703 | git config branch.autosetuprebase never && | |
0cb0e143 | 704 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
705 | git branch --track myr6 local/master && |
706 | test "$(git config branch.myr6.remote)" = local && | |
707 | test "$(git config branch.myr6.merge)" = refs/heads/master && | |
708 | ! test "$(git config branch.myr6.rebase)" = true | |
709 | ' | |
710 | ||
711 | test_expect_success 'autosetuprebase remote on a tracked remote branch' ' | |
712 | git config remote.local.url . && | |
713 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
714 | git config branch.autosetuprebase remote && | |
0cb0e143 | 715 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
716 | git branch --track myr7 local/master && |
717 | test "$(git config branch.myr7.remote)" = local && | |
718 | test "$(git config branch.myr7.merge)" = refs/heads/master && | |
719 | test "$(git config branch.myr7.rebase)" = true | |
720 | ' | |
721 | ||
722 | test_expect_success 'autosetuprebase always on a tracked remote branch' ' | |
723 | git config remote.local.url . && | |
724 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
725 | git config branch.autosetuprebase remote && | |
0cb0e143 | 726 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
727 | git branch --track myr8 local/master && |
728 | test "$(git config branch.myr8.remote)" = local && | |
729 | test "$(git config branch.myr8.merge)" = refs/heads/master && | |
730 | test "$(git config branch.myr8.rebase)" = true | |
731 | ' | |
732 | ||
733 | test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' ' | |
734 | git config --unset branch.autosetuprebase && | |
735 | git config remote.local.url . && | |
736 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 737 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
738 | git branch --track myr9 local/master && |
739 | test "$(git config branch.myr9.remote)" = local && | |
740 | test "$(git config branch.myr9.merge)" = refs/heads/master && | |
741 | test "z$(git config branch.myr9.rebase)" = z | |
742 | ' | |
743 | ||
744 | test_expect_success 'autosetuprebase unconfigured on a tracked local branch' ' | |
745 | git config remote.local.url . && | |
746 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 747 | (git show-ref -q refs/remotes/local/o || git fetch local) && |
c998ae9b DS |
748 | git branch mybase10 && |
749 | git branch --track myr10 mybase2 && | |
750 | test "$(git config branch.myr10.remote)" = . && | |
751 | test "$(git config branch.myr10.merge)" = refs/heads/mybase2 && | |
752 | test "z$(git config branch.myr10.rebase)" = z | |
753 | ' | |
754 | ||
755 | test_expect_success 'autosetuprebase unconfigured on untracked local branch' ' | |
756 | git config remote.local.url . && | |
757 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 758 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
759 | git branch --no-track myr11 mybase2 && |
760 | test "z$(git config branch.myr11.remote)" = z && | |
761 | test "z$(git config branch.myr11.merge)" = z && | |
762 | test "z$(git config branch.myr11.rebase)" = z | |
763 | ' | |
764 | ||
765 | test_expect_success 'autosetuprebase unconfigured on untracked remote branch' ' | |
766 | git config remote.local.url . && | |
767 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 768 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
769 | git branch --no-track myr12 local/master && |
770 | test "z$(git config branch.myr12.remote)" = z && | |
771 | test "z$(git config branch.myr12.merge)" = z && | |
772 | test "z$(git config branch.myr12.rebase)" = z | |
773 | ' | |
774 | ||
775 | test_expect_success 'autosetuprebase never on an untracked local branch' ' | |
776 | git config branch.autosetuprebase never && | |
777 | git config remote.local.url . && | |
778 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 779 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
780 | git branch --no-track myr13 mybase2 && |
781 | test "z$(git config branch.myr13.remote)" = z && | |
782 | test "z$(git config branch.myr13.merge)" = z && | |
783 | test "z$(git config branch.myr13.rebase)" = z | |
784 | ' | |
785 | ||
786 | test_expect_success 'autosetuprebase local on an untracked local branch' ' | |
787 | git config branch.autosetuprebase local && | |
788 | git config remote.local.url . && | |
789 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 790 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
791 | git branch --no-track myr14 mybase2 && |
792 | test "z$(git config branch.myr14.remote)" = z && | |
793 | test "z$(git config branch.myr14.merge)" = z && | |
794 | test "z$(git config branch.myr14.rebase)" = z | |
795 | ' | |
796 | ||
797 | test_expect_success 'autosetuprebase remote on an untracked local branch' ' | |
798 | git config branch.autosetuprebase remote && | |
799 | git config remote.local.url . && | |
800 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 801 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
802 | git branch --no-track myr15 mybase2 && |
803 | test "z$(git config branch.myr15.remote)" = z && | |
804 | test "z$(git config branch.myr15.merge)" = z && | |
805 | test "z$(git config branch.myr15.rebase)" = z | |
806 | ' | |
807 | ||
808 | test_expect_success 'autosetuprebase always on an untracked local branch' ' | |
809 | git config branch.autosetuprebase always && | |
810 | git config remote.local.url . && | |
811 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 812 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
813 | git branch --no-track myr16 mybase2 && |
814 | test "z$(git config branch.myr16.remote)" = z && | |
815 | test "z$(git config branch.myr16.merge)" = z && | |
816 | test "z$(git config branch.myr16.rebase)" = z | |
817 | ' | |
818 | ||
819 | test_expect_success 'autosetuprebase never on an untracked remote branch' ' | |
820 | git config branch.autosetuprebase never && | |
821 | git config remote.local.url . && | |
822 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 823 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
824 | git branch --no-track myr17 local/master && |
825 | test "z$(git config branch.myr17.remote)" = z && | |
826 | test "z$(git config branch.myr17.merge)" = z && | |
827 | test "z$(git config branch.myr17.rebase)" = z | |
828 | ' | |
829 | ||
830 | test_expect_success 'autosetuprebase local on an untracked remote branch' ' | |
831 | git config branch.autosetuprebase local && | |
832 | git config remote.local.url . && | |
833 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 834 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
835 | git branch --no-track myr18 local/master && |
836 | test "z$(git config branch.myr18.remote)" = z && | |
837 | test "z$(git config branch.myr18.merge)" = z && | |
838 | test "z$(git config branch.myr18.rebase)" = z | |
839 | ' | |
840 | ||
841 | test_expect_success 'autosetuprebase remote on an untracked remote branch' ' | |
842 | git config branch.autosetuprebase remote && | |
843 | git config remote.local.url . && | |
844 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 845 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
846 | git branch --no-track myr19 local/master && |
847 | test "z$(git config branch.myr19.remote)" = z && | |
848 | test "z$(git config branch.myr19.merge)" = z && | |
849 | test "z$(git config branch.myr19.rebase)" = z | |
850 | ' | |
851 | ||
852 | test_expect_success 'autosetuprebase always on an untracked remote branch' ' | |
853 | git config branch.autosetuprebase always && | |
854 | git config remote.local.url . && | |
855 | git config remote.local.fetch refs/heads/*:refs/remotes/local/* && | |
0cb0e143 | 856 | (git show-ref -q refs/remotes/local/master || git fetch local) && |
c998ae9b DS |
857 | git branch --no-track myr20 local/master && |
858 | test "z$(git config branch.myr20.remote)" = z && | |
859 | test "z$(git config branch.myr20.merge)" = z && | |
860 | test "z$(git config branch.myr20.rebase)" = z | |
861 | ' | |
862 | ||
21b5b1e8 JH |
863 | test_expect_success 'autosetuprebase always on detached HEAD' ' |
864 | git config branch.autosetupmerge always && | |
865 | test_when_finished git checkout master && | |
866 | git checkout HEAD^0 && | |
867 | git branch my11 && | |
868 | test -z "$(git config branch.my11.remote)" && | |
869 | test -z "$(git config branch.my11.merge)" | |
870 | ' | |
871 | ||
c998ae9b DS |
872 | test_expect_success 'detect misconfigured autosetuprebase (bad value)' ' |
873 | git config branch.autosetuprebase garbage && | |
874 | test_must_fail git branch | |
875 | ' | |
876 | ||
877 | test_expect_success 'detect misconfigured autosetuprebase (no value)' ' | |
878 | git config --unset branch.autosetuprebase && | |
0d158ebb | 879 | echo "[branch] autosetuprebase" >>.git/config && |
c998ae9b DS |
880 | test_must_fail git branch && |
881 | git config --unset branch.autosetuprebase | |
882 | ' | |
883 | ||
99c419c9 JH |
884 | test_expect_success 'attempt to delete a branch without base and unmerged to HEAD' ' |
885 | git checkout my9 && | |
886 | git config --unset branch.my8.merge && | |
887 | test_must_fail git branch -d my8 | |
888 | ' | |
889 | ||
890 | test_expect_success 'attempt to delete a branch merged to its base' ' | |
891 | # we are on my9 which is the initial commit; traditionally | |
892 | # we would not have allowed deleting my8 that is not merged | |
893 | # to my9, but it is set to track master that already has my8 | |
894 | git config branch.my8.merge refs/heads/master && | |
895 | git branch -d my8 | |
896 | ' | |
897 | ||
898 | test_expect_success 'attempt to delete a branch merged to its base' ' | |
899 | git checkout master && | |
900 | echo Third >>A && | |
901 | git commit -m "Third commit" A && | |
902 | git branch -t my10 my9 && | |
903 | git branch -f my10 HEAD^ && | |
904 | # we are on master which is at the third commit, and my10 | |
905 | # is behind us, so traditionally we would have allowed deleting | |
906 | # it; but my10 is set to track my9 that is further behind. | |
907 | test_must_fail git branch -d my10 | |
908 | ' | |
909 | ||
fa799376 JH |
910 | test_expect_success 'use set-upstream on the current branch' ' |
911 | git checkout master && | |
912 | git --bare init myupstream.git && | |
913 | git push myupstream.git master:refs/heads/frotz && | |
914 | git remote add origin myupstream.git && | |
915 | git fetch && | |
916 | git branch --set-upstream master origin/frotz && | |
917 | ||
918 | test "z$(git config branch.master.remote)" = "zorigin" && | |
919 | test "z$(git config branch.master.merge)" = "zrefs/heads/frotz" | |
920 | ||
921 | ' | |
922 | ||
c2d17ba3 JH |
923 | test_expect_success 'use --edit-description' ' |
924 | write_script editor <<-\EOF && | |
925 | echo "New contents" >"$1" | |
926 | EOF | |
927 | EDITOR=./editor git branch --edit-description && | |
928 | write_script editor <<-\EOF && | |
929 | git stripspace -s <"$1" >"EDITOR_OUTPUT" | |
930 | EOF | |
931 | EDITOR=./editor git branch --edit-description && | |
932 | echo "New contents" >expect && | |
933 | test_cmp EDITOR_OUTPUT expect | |
934 | ' | |
935 | ||
936 | test_expect_success 'detect typo in branch name when using --edit-description' ' | |
937 | write_script editor <<-\EOF && | |
938 | echo "New contents" >"$1" | |
939 | EOF | |
512477b1 | 940 | test_must_fail env EDITOR=./editor git branch --edit-description no-such-branch |
c2d17ba3 JH |
941 | ' |
942 | ||
943 | test_expect_success 'refuse --edit-description on unborn branch for now' ' | |
944 | write_script editor <<-\EOF && | |
945 | echo "New contents" >"$1" | |
946 | EOF | |
947 | git checkout --orphan unborn && | |
512477b1 | 948 | test_must_fail env EDITOR=./editor git branch --edit-description |
c2d17ba3 JH |
949 | ' |
950 | ||
6c41e975 CMN |
951 | test_expect_success '--merged catches invalid object names' ' |
952 | test_must_fail git branch --merged 0000000000000000000000000000000000000000 | |
953 | ' | |
954 | ||
1d7358c5 | 955 | test_expect_success 'tracking with unexpected .fetch refspec' ' |
b0f49ff1 | 956 | rm -rf a b c d && |
62d94a3a JH |
957 | git init a && |
958 | ( | |
959 | cd a && | |
960 | test_commit a | |
961 | ) && | |
962 | git init b && | |
963 | ( | |
964 | cd b && | |
965 | test_commit b | |
966 | ) && | |
967 | git init c && | |
968 | ( | |
969 | cd c && | |
970 | test_commit c && | |
971 | git remote add a ../a && | |
972 | git remote add b ../b && | |
973 | git fetch --all | |
974 | ) && | |
975 | git init d && | |
976 | ( | |
977 | cd d && | |
978 | git remote add c ../c && | |
979 | git config remote.c.fetch "+refs/remotes/*:refs/remotes/*" && | |
980 | git fetch c && | |
981 | git branch --track local/a/master remotes/a/master && | |
982 | test "$(git config branch.local/a/master.remote)" = "c" && | |
983 | test "$(git config branch.local/a/master.merge)" = "refs/remotes/a/master" && | |
984 | git rev-parse --verify a >expect && | |
985 | git rev-parse --verify local/a/master >actual && | |
986 | test_cmp expect actual | |
987 | ) | |
988 | ' | |
989 | ||
a3b427b9 | 990 | test_done |