3 test_description
='test refspec written by clone-command'
6 test_expect_success
'setup' '
7 # Make two branches, "master" and "side"
12 git commit -a -m two &&
15 git commit -a -m three &&
16 git checkout -b side &&
18 git commit -a -m four &&
19 git checkout master &&
22 git clone . dir_all &&
24 # default --single that follows HEAD=master
25 git clone --single-branch . dir_master &&
27 # default --single that follows HEAD=side
29 git clone --single-branch . dir_side &&
31 # explicit --single that follows side
32 git checkout master &&
33 git clone --single-branch --branch side . dir_side2 &&
35 # default --single with --mirror
36 git clone --single-branch --mirror . dir_mirror &&
38 # default --single with --branch and --mirror
39 git clone --single-branch --mirror --branch side . dir_mirror_side &&
41 # --single that does not know what branch to follow
43 git clone --single-branch . dir_detached &&
45 # explicit --single with tag
46 git clone --single-branch --branch two . dir_tag &&
48 # advance both "master" and "side" branches
51 git commit -a -m five &&
52 git checkout master &&
54 git commit -a -m six &&
57 git tag -d two && git tag two
60 test_expect_success
'by default all branches will be kept updated' '
64 git for-each-ref refs/remotes/origin |
66 -e "s|/remotes/origin/|/heads/|" >../actual
68 # follow both master and side
69 git for-each-ref refs/heads >expect &&
70 test_cmp expect actual
73 test_expect_success
'by default no tags will be kept updated' '
77 git for-each-ref refs/tags >../actual
79 git for-each-ref refs/tags >expect &&
80 test_must_fail test_cmp expect actual
83 test_expect_success
'--single-branch while HEAD pointing at master' '
87 git for-each-ref refs/remotes/origin |
89 -e "s|/remotes/origin/|/heads/|" >../actual
92 git for-each-ref refs/heads/master >expect &&
93 test_cmp expect actual
96 test_expect_success
'--single-branch while HEAD pointing at side' '
100 git for-each-ref refs/remotes/origin |
102 -e "s|/remotes/origin/|/heads/|" >../actual
105 git for-each-ref refs/heads/side >expect &&
106 test_cmp expect actual
109 test_expect_success
'--single-branch with explicit --branch side' '
113 git for-each-ref refs/remotes/origin |
115 -e "s|/remotes/origin/|/heads/|" >../actual
118 git for-each-ref refs/heads/side >expect &&
119 test_cmp expect actual
122 test_expect_success
'--single-branch with explicit --branch with tag fetches updated tag' '
126 git for-each-ref refs/tags >../actual
128 git for-each-ref refs/tags >expect &&
129 test_cmp expect actual
132 test_expect_success
'--single-branch with --mirror' '
136 git for-each-ref refs > ../actual
138 git for-each-ref refs >expect &&
139 test_cmp expect actual
142 test_expect_success
'--single-branch with explicit --branch and --mirror' '
144 cd dir_mirror_side &&
146 git for-each-ref refs > ../actual
148 git for-each-ref refs >expect &&
149 test_cmp expect actual
152 test_expect_success
'--single-branch with detached' '
156 git for-each-ref refs/remotes/origin |
158 -e "s|/remotes/origin/|/heads/|" >../actual
162 test_cmp expect actual