Code

t/Makefile: Use $(sort ...) explicitly where needed
[git.git] / t / t3200-branch.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2005 Amos Waterland
4 #
6 test_description='git branch --foo should not create bogus branch
8 This test runs git branch --help and checks that the argument is properly
9 handled.  Specifically, that a bogus branch is not created.
10 '
11 . ./test-lib.sh
13 test_expect_success \
14     'prepare a trivial repository' \
15     'echo Hello > A &&
16      git update-index --add A &&
17      git commit -m "Initial commit." &&
18      echo World >> A &&
19      git update-index --add A &&
20      git commit -m "Second commit." &&
21      HEAD=$(git rev-parse --verify HEAD)'
23 test_expect_success \
24     'git branch --help should not have created a bogus branch' '
25      git branch --help </dev/null >/dev/null 2>/dev/null;
26      test_path_is_missing .git/refs/heads/--help
27 '
29 test_expect_success 'branch -h in broken repository' '
30         mkdir broken &&
31         (
32                 cd broken &&
33                 git init &&
34                 >.git/refs/heads/master &&
35                 test_expect_code 129 git branch -h >usage 2>&1
36         ) &&
37         grep "[Uu]sage" broken/usage
38 '
40 test_expect_success \
41     'git branch abc should create a branch' \
42     'git branch abc && test_path_is_file .git/refs/heads/abc'
44 test_expect_success \
45     'git branch a/b/c should create a branch' \
46     'git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c'
48 cat >expect <<EOF
49 $_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
50 EOF
51 test_expect_success \
52     'git branch -l d/e/f should create a branch and a log' \
53         'GIT_COMMITTER_DATE="2005-05-26 23:30" \
54      git branch -l d/e/f &&
55          test_path_is_file .git/refs/heads/d/e/f &&
56          test_path_is_file .git/logs/refs/heads/d/e/f &&
57          test_cmp expect .git/logs/refs/heads/d/e/f'
59 test_expect_success \
60     'git branch -d d/e/f should delete a branch and a log' \
61         'git branch -d d/e/f &&
62          test_path_is_missing .git/refs/heads/d/e/f &&
63          test_path_is_missing .git/logs/refs/heads/d/e/f'
65 test_expect_success \
66     'git branch j/k should work after branch j has been deleted' \
67        'git branch j &&
68         git branch -d j &&
69         git branch j/k'
71 test_expect_success \
72     'git branch l should work after branch l/m has been deleted' \
73        'git branch l/m &&
74         git branch -d l/m &&
75         git branch l'
77 test_expect_success \
78     'git branch -m dumps usage' \
79        'test_expect_code 129 git branch -m 2>err &&
80         grep "[Uu]sage: git branch" err'
82 test_expect_success \
83     'git branch -m m m/m should work' \
84        'git branch -l m &&
85         git branch -m m m/m &&
86         test_path_is_file .git/logs/refs/heads/m/m'
88 test_expect_success \
89     'git branch -m n/n n should work' \
90        'git branch -l n/n &&
91         git branch -m n/n n
92         test_path_is_file .git/logs/refs/heads/n'
94 test_expect_success 'git branch -m o/o o should fail when o/p exists' '
95         git branch o/o &&
96         git branch o/p &&
97         test_must_fail git branch -m o/o o
98 '
100 test_expect_success 'git branch -m q r/q should fail when r exists' '
101         git branch q &&
102         git branch r &&
103         test_must_fail git branch -m q r/q
106 test_expect_success 'git branch -M foo bar should fail when bar is checked out' '
107         git branch bar &&
108         git checkout -b foo &&
109         test_must_fail git branch -M bar foo
112 test_expect_success 'git branch -M baz bam should succeed when baz is checked out' '
113         git checkout -b baz &&
114         git branch bam &&
115         git branch -M baz bam
118 test_expect_success 'git branch -v -d t should work' '
119         git branch t &&
120         test_path_is_file .git/refs/heads/t &&
121         git branch -v -d t &&
122         test_path_is_missing .git/refs/heads/t
125 test_expect_success 'git branch -v -m t s should work' '
126         git branch t &&
127         test_path_is_file .git/refs/heads/t &&
128         git branch -v -m t s &&
129         test_path_is_missing .git/refs/heads/t &&
130         test_path_is_file .git/refs/heads/s &&
131         git branch -d s
134 test_expect_success 'git branch -m -d t s should fail' '
135         git branch t &&
136         test_path_is_file .git/refs/heads/t &&
137         test_must_fail git branch -m -d t s &&
138         git branch -d t &&
139         test_path_is_missing .git/refs/heads/t
142 test_expect_success 'git branch --list -d t should fail' '
143         git branch t &&
144         test_path_is_file .git/refs/heads/t &&
145         test_must_fail git branch --list -d t &&
146         git branch -d t &&
147         test_path_is_missing .git/refs/heads/t
150 mv .git/config .git/config-saved
152 test_expect_success 'git branch -m q q2 without config should succeed' '
153         git branch -m q q2 &&
154         git branch -m q2 q
157 mv .git/config-saved .git/config
159 git config branch.s/s.dummy Hello
161 test_expect_success \
162     'git branch -m s/s s should work when s/t is deleted' \
163        'git branch -l s/s &&
164         test_path_is_file .git/logs/refs/heads/s/s &&
165         git branch -l s/t &&
166         test_path_is_file .git/logs/refs/heads/s/t &&
167         git branch -d s/t &&
168         git branch -m s/s s &&
169         test_path_is_file .git/logs/refs/heads/s'
171 test_expect_success 'config information was renamed, too' \
172         "test $(git config branch.s.dummy) = Hello &&
173          test_must_fail git config branch.s/s/dummy"
175 test_expect_success 'renaming a symref is not allowed' \
177         git symbolic-ref refs/heads/master2 refs/heads/master &&
178         test_must_fail git branch -m master2 master3 &&
179         git symbolic-ref refs/heads/master2 &&
180         test_path_is_file .git/refs/heads/master &&
181         test_path_is_missing .git/refs/heads/master3
184 test_expect_success SYMLINKS \
185     'git branch -m u v should fail when the reflog for u is a symlink' '
186      git branch -l u &&
187      mv .git/logs/refs/heads/u real-u &&
188      ln -s real-u .git/logs/refs/heads/u &&
189      test_must_fail git branch -m u v
192 test_expect_success 'test tracking setup via --track' \
193     'git config remote.local.url . &&
194      git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
195      (git show-ref -q refs/remotes/local/master || git fetch local) &&
196      git branch --track my1 local/master &&
197      test $(git config branch.my1.remote) = local &&
198      test $(git config branch.my1.merge) = refs/heads/master'
200 test_expect_success 'test tracking setup (non-wildcard, matching)' \
201     'git config remote.local.url . &&
202      git config remote.local.fetch refs/heads/master:refs/remotes/local/master &&
203      (git show-ref -q refs/remotes/local/master || git fetch local) &&
204      git branch --track my4 local/master &&
205      test $(git config branch.my4.remote) = local &&
206      test $(git config branch.my4.merge) = refs/heads/master'
208 test_expect_success 'test tracking setup (non-wildcard, not matching)' \
209     'git config remote.local.url . &&
210      git config remote.local.fetch refs/heads/s:refs/remotes/local/s &&
211      (git show-ref -q refs/remotes/local/master || git fetch local) &&
212      git branch --track my5 local/master &&
213      ! test "$(git config branch.my5.remote)" = local &&
214      ! test "$(git config branch.my5.merge)" = refs/heads/master'
216 test_expect_success 'test tracking setup via config' \
217     'git config branch.autosetupmerge true &&
218      git config remote.local.url . &&
219      git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
220      (git show-ref -q refs/remotes/local/master || git fetch local) &&
221      git branch my3 local/master &&
222      test $(git config branch.my3.remote) = local &&
223      test $(git config branch.my3.merge) = refs/heads/master'
225 test_expect_success 'test overriding tracking setup via --no-track' \
226     'git config branch.autosetupmerge true &&
227      git config remote.local.url . &&
228      git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
229      (git show-ref -q refs/remotes/local/master || git fetch local) &&
230      git branch --no-track my2 local/master &&
231      git config branch.autosetupmerge false &&
232      ! test "$(git config branch.my2.remote)" = local &&
233      ! test "$(git config branch.my2.merge)" = refs/heads/master'
235 test_expect_success 'no tracking without .fetch entries' \
236     'git config branch.autosetupmerge true &&
237      git branch my6 s &&
238      git config branch.automsetupmerge false &&
239      test -z "$(git config branch.my6.remote)" &&
240      test -z "$(git config branch.my6.merge)"'
242 test_expect_success 'test tracking setup via --track but deeper' \
243     'git config remote.local.url . &&
244      git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
245      (git show-ref -q refs/remotes/local/o/o || git fetch local) &&
246      git branch --track my7 local/o/o &&
247      test "$(git config branch.my7.remote)" = local &&
248      test "$(git config branch.my7.merge)" = refs/heads/o/o'
250 test_expect_success 'test deleting branch deletes branch config' \
251     'git branch -d my7 &&
252      test -z "$(git config branch.my7.remote)" &&
253      test -z "$(git config branch.my7.merge)"'
255 test_expect_success 'test deleting branch without config' \
256     'git branch my7 s &&
257      sha1=$(git rev-parse my7 | cut -c 1-7) &&
258      echo "Deleted branch my7 (was $sha1)." >expect &&
259      git branch -d my7 >actual 2>&1 &&
260      test_i18ncmp expect actual'
262 test_expect_success 'test --track without .fetch entries' \
263     'git branch --track my8 &&
264      test "$(git config branch.my8.remote)" &&
265      test "$(git config branch.my8.merge)"'
267 test_expect_success \
268     'branch from non-branch HEAD w/autosetupmerge=always' \
269     'git config branch.autosetupmerge always &&
270      git branch my9 HEAD^ &&
271      git config branch.autosetupmerge false'
273 test_expect_success \
274     'branch from non-branch HEAD w/--track causes failure' \
275     'test_must_fail git branch --track my10 HEAD^'
277 test_expect_success \
278     'branch from tag w/--track causes failure' \
279     'git tag foobar &&
280      test_must_fail git branch --track my11 foobar'
282 # Keep this test last, as it changes the current branch
283 cat >expect <<EOF
284 $_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
285 EOF
286 test_expect_success \
287     'git checkout -b g/h/i -l should create a branch and a log' \
288         'GIT_COMMITTER_DATE="2005-05-26 23:30" \
289      git checkout -b g/h/i -l master &&
290          test_path_is_file .git/refs/heads/g/h/i &&
291          test_path_is_file .git/logs/refs/heads/g/h/i &&
292          test_cmp expect .git/logs/refs/heads/g/h/i'
294 test_expect_success 'checkout -b makes reflog by default' '
295         git checkout master &&
296         git config --unset core.logAllRefUpdates &&
297         git checkout -b alpha &&
298         git rev-parse --verify alpha@{0}
301 test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' '
302         git checkout master &&
303         git config core.logAllRefUpdates false &&
304         git checkout -b beta &&
305         test_must_fail git rev-parse --verify beta@{0}
308 test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
309         git checkout master &&
310         git checkout -lb gamma &&
311         git config --unset core.logAllRefUpdates &&
312         git rev-parse --verify gamma@{0}
315 test_expect_success 'avoid ambiguous track' '
316         git config branch.autosetupmerge true &&
317         git config remote.ambi1.url lalala &&
318         git config remote.ambi1.fetch refs/heads/lalala:refs/heads/master &&
319         git config remote.ambi2.url lilili &&
320         git config remote.ambi2.fetch refs/heads/lilili:refs/heads/master &&
321         git branch all1 master &&
322         test -z "$(git config branch.all1.merge)"
325 test_expect_success 'autosetuprebase local on a tracked local branch' '
326         git config remote.local.url . &&
327         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
328         git config branch.autosetuprebase local &&
329         (git show-ref -q refs/remotes/local/o || git fetch local) &&
330         git branch mybase &&
331         git branch --track myr1 mybase &&
332         test "$(git config branch.myr1.remote)" = . &&
333         test "$(git config branch.myr1.merge)" = refs/heads/mybase &&
334         test "$(git config branch.myr1.rebase)" = true
337 test_expect_success 'autosetuprebase always on a tracked local branch' '
338         git config remote.local.url . &&
339         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
340         git config branch.autosetuprebase always &&
341         (git show-ref -q refs/remotes/local/o || git fetch local) &&
342         git branch mybase2 &&
343         git branch --track myr2 mybase &&
344         test "$(git config branch.myr2.remote)" = . &&
345         test "$(git config branch.myr2.merge)" = refs/heads/mybase &&
346         test "$(git config branch.myr2.rebase)" = true
349 test_expect_success 'autosetuprebase remote on a tracked local branch' '
350         git config remote.local.url . &&
351         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
352         git config branch.autosetuprebase remote &&
353         (git show-ref -q refs/remotes/local/o || git fetch local) &&
354         git branch mybase3 &&
355         git branch --track myr3 mybase2 &&
356         test "$(git config branch.myr3.remote)" = . &&
357         test "$(git config branch.myr3.merge)" = refs/heads/mybase2 &&
358         ! test "$(git config branch.myr3.rebase)" = true
361 test_expect_success 'autosetuprebase never on a tracked local branch' '
362         git config remote.local.url . &&
363         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
364         git config branch.autosetuprebase never &&
365         (git show-ref -q refs/remotes/local/o || git fetch local) &&
366         git branch mybase4 &&
367         git branch --track myr4 mybase2 &&
368         test "$(git config branch.myr4.remote)" = . &&
369         test "$(git config branch.myr4.merge)" = refs/heads/mybase2 &&
370         ! test "$(git config branch.myr4.rebase)" = true
373 test_expect_success 'autosetuprebase local on a tracked remote branch' '
374         git config remote.local.url . &&
375         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
376         git config branch.autosetuprebase local &&
377         (git show-ref -q refs/remotes/local/master || git fetch local) &&
378         git branch --track myr5 local/master &&
379         test "$(git config branch.myr5.remote)" = local &&
380         test "$(git config branch.myr5.merge)" = refs/heads/master &&
381         ! test "$(git config branch.myr5.rebase)" = true
384 test_expect_success 'autosetuprebase never on a tracked remote branch' '
385         git config remote.local.url . &&
386         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
387         git config branch.autosetuprebase never &&
388         (git show-ref -q refs/remotes/local/master || git fetch local) &&
389         git branch --track myr6 local/master &&
390         test "$(git config branch.myr6.remote)" = local &&
391         test "$(git config branch.myr6.merge)" = refs/heads/master &&
392         ! test "$(git config branch.myr6.rebase)" = true
395 test_expect_success 'autosetuprebase remote on a tracked remote branch' '
396         git config remote.local.url . &&
397         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
398         git config branch.autosetuprebase remote &&
399         (git show-ref -q refs/remotes/local/master || git fetch local) &&
400         git branch --track myr7 local/master &&
401         test "$(git config branch.myr7.remote)" = local &&
402         test "$(git config branch.myr7.merge)" = refs/heads/master &&
403         test "$(git config branch.myr7.rebase)" = true
406 test_expect_success 'autosetuprebase always on a tracked remote branch' '
407         git config remote.local.url . &&
408         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
409         git config branch.autosetuprebase remote &&
410         (git show-ref -q refs/remotes/local/master || git fetch local) &&
411         git branch --track myr8 local/master &&
412         test "$(git config branch.myr8.remote)" = local &&
413         test "$(git config branch.myr8.merge)" = refs/heads/master &&
414         test "$(git config branch.myr8.rebase)" = true
417 test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '
418         git config --unset branch.autosetuprebase &&
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/master || git fetch local) &&
422         git branch --track myr9 local/master &&
423         test "$(git config branch.myr9.remote)" = local &&
424         test "$(git config branch.myr9.merge)" = refs/heads/master &&
425         test "z$(git config branch.myr9.rebase)" = z
428 test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
429         git config remote.local.url . &&
430         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
431         (git show-ref -q refs/remotes/local/o || git fetch local) &&
432         git branch mybase10 &&
433         git branch --track myr10 mybase2 &&
434         test "$(git config branch.myr10.remote)" = . &&
435         test "$(git config branch.myr10.merge)" = refs/heads/mybase2 &&
436         test "z$(git config branch.myr10.rebase)" = z
439 test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
440         git config remote.local.url . &&
441         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
442         (git show-ref -q refs/remotes/local/master || git fetch local) &&
443         git branch --no-track myr11 mybase2 &&
444         test "z$(git config branch.myr11.remote)" = z &&
445         test "z$(git config branch.myr11.merge)" = z &&
446         test "z$(git config branch.myr11.rebase)" = z
449 test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '
450         git config remote.local.url . &&
451         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
452         (git show-ref -q refs/remotes/local/master || git fetch local) &&
453         git branch --no-track myr12 local/master &&
454         test "z$(git config branch.myr12.remote)" = z &&
455         test "z$(git config branch.myr12.merge)" = z &&
456         test "z$(git config branch.myr12.rebase)" = z
459 test_expect_success 'autosetuprebase never on an untracked local branch' '
460         git config branch.autosetuprebase never &&
461         git config remote.local.url . &&
462         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
463         (git show-ref -q refs/remotes/local/master || git fetch local) &&
464         git branch --no-track myr13 mybase2 &&
465         test "z$(git config branch.myr13.remote)" = z &&
466         test "z$(git config branch.myr13.merge)" = z &&
467         test "z$(git config branch.myr13.rebase)" = z
470 test_expect_success 'autosetuprebase local on an untracked local branch' '
471         git config branch.autosetuprebase local &&
472         git config remote.local.url . &&
473         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
474         (git show-ref -q refs/remotes/local/master || git fetch local) &&
475         git branch --no-track myr14 mybase2 &&
476         test "z$(git config branch.myr14.remote)" = z &&
477         test "z$(git config branch.myr14.merge)" = z &&
478         test "z$(git config branch.myr14.rebase)" = z
481 test_expect_success 'autosetuprebase remote on an untracked local branch' '
482         git config branch.autosetuprebase remote &&
483         git config remote.local.url . &&
484         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
485         (git show-ref -q refs/remotes/local/master || git fetch local) &&
486         git branch --no-track myr15 mybase2 &&
487         test "z$(git config branch.myr15.remote)" = z &&
488         test "z$(git config branch.myr15.merge)" = z &&
489         test "z$(git config branch.myr15.rebase)" = z
492 test_expect_success 'autosetuprebase always on an untracked local branch' '
493         git config branch.autosetuprebase always &&
494         git config remote.local.url . &&
495         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
496         (git show-ref -q refs/remotes/local/master || git fetch local) &&
497         git branch --no-track myr16 mybase2 &&
498         test "z$(git config branch.myr16.remote)" = z &&
499         test "z$(git config branch.myr16.merge)" = z &&
500         test "z$(git config branch.myr16.rebase)" = z
503 test_expect_success 'autosetuprebase never on an untracked remote branch' '
504         git config branch.autosetuprebase never &&
505         git config remote.local.url . &&
506         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
507         (git show-ref -q refs/remotes/local/master || git fetch local) &&
508         git branch --no-track myr17 local/master &&
509         test "z$(git config branch.myr17.remote)" = z &&
510         test "z$(git config branch.myr17.merge)" = z &&
511         test "z$(git config branch.myr17.rebase)" = z
514 test_expect_success 'autosetuprebase local on an untracked remote branch' '
515         git config branch.autosetuprebase local &&
516         git config remote.local.url . &&
517         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
518         (git show-ref -q refs/remotes/local/master || git fetch local) &&
519         git branch --no-track myr18 local/master &&
520         test "z$(git config branch.myr18.remote)" = z &&
521         test "z$(git config branch.myr18.merge)" = z &&
522         test "z$(git config branch.myr18.rebase)" = z
525 test_expect_success 'autosetuprebase remote on an untracked remote branch' '
526         git config branch.autosetuprebase remote &&
527         git config remote.local.url . &&
528         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
529         (git show-ref -q refs/remotes/local/master || git fetch local) &&
530         git branch --no-track myr19 local/master &&
531         test "z$(git config branch.myr19.remote)" = z &&
532         test "z$(git config branch.myr19.merge)" = z &&
533         test "z$(git config branch.myr19.rebase)" = z
536 test_expect_success 'autosetuprebase always on an untracked remote branch' '
537         git config branch.autosetuprebase always &&
538         git config remote.local.url . &&
539         git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
540         (git show-ref -q refs/remotes/local/master || git fetch local) &&
541         git branch --no-track myr20 local/master &&
542         test "z$(git config branch.myr20.remote)" = z &&
543         test "z$(git config branch.myr20.merge)" = z &&
544         test "z$(git config branch.myr20.rebase)" = z
547 test_expect_success 'autosetuprebase always on detached HEAD' '
548         git config branch.autosetupmerge always &&
549         test_when_finished git checkout master &&
550         git checkout HEAD^0 &&
551         git branch my11 &&
552         test -z "$(git config branch.my11.remote)" &&
553         test -z "$(git config branch.my11.merge)"
556 test_expect_success 'detect misconfigured autosetuprebase (bad value)' '
557         git config branch.autosetuprebase garbage &&
558         test_must_fail git branch
561 test_expect_success 'detect misconfigured autosetuprebase (no value)' '
562         git config --unset branch.autosetuprebase &&
563         echo "[branch] autosetuprebase" >> .git/config &&
564         test_must_fail git branch &&
565         git config --unset branch.autosetuprebase
568 test_expect_success 'attempt to delete a branch without base and unmerged to HEAD' '
569         git checkout my9 &&
570         git config --unset branch.my8.merge &&
571         test_must_fail git branch -d my8
574 test_expect_success 'attempt to delete a branch merged to its base' '
575         # we are on my9 which is the initial commit; traditionally
576         # we would not have allowed deleting my8 that is not merged
577         # to my9, but it is set to track master that already has my8
578         git config branch.my8.merge refs/heads/master &&
579         git branch -d my8
582 test_expect_success 'attempt to delete a branch merged to its base' '
583         git checkout master &&
584         echo Third >>A &&
585         git commit -m "Third commit" A &&
586         git branch -t my10 my9 &&
587         git branch -f my10 HEAD^ &&
588         # we are on master which is at the third commit, and my10
589         # is behind us, so traditionally we would have allowed deleting
590         # it; but my10 is set to track my9 that is further behind.
591         test_must_fail git branch -d my10
594 test_expect_success 'use set-upstream on the current branch' '
595         git checkout master &&
596         git --bare init myupstream.git &&
597         git push myupstream.git master:refs/heads/frotz &&
598         git remote add origin myupstream.git &&
599         git fetch &&
600         git branch --set-upstream master origin/frotz &&
602         test "z$(git config branch.master.remote)" = "zorigin" &&
603         test "z$(git config branch.master.merge)" = "zrefs/heads/frotz"
607 test_done