convert: quote filter names in error messages
[git/git-svn.git] / t / t5612-clone-refspec.sh
blob7ace2535c80e988e353ae09ecbf3bb24d6106ecc
1 #!/bin/sh
3 test_description='test refspec written by clone-command'
4 . ./test-lib.sh
6 test_expect_success 'setup' '
7 # Make two branches, "master" and "side"
8 echo one >file &&
9 git add file &&
10 git commit -m one &&
11 echo two >file &&
12 git commit -a -m two &&
13 git tag two &&
14 echo three >file &&
15 git commit -a -m three &&
16 git checkout -b side &&
17 echo four >file &&
18 git commit -a -m four &&
19 git checkout master &&
21 # default clone
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
28 git checkout 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
42 git checkout two^ &&
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
49 git checkout side &&
50 echo five >file &&
51 git commit -a -m five &&
52 git checkout master &&
53 echo six >file &&
54 git commit -a -m six &&
56 # update tag
57 git tag -d two && git tag two
60 test_expect_success 'by default all branches will be kept updated' '
62 cd dir_all && git fetch &&
63 git for-each-ref refs/remotes/origin |
64 sed -e "/HEAD$/d" \
65 -e "s|/remotes/origin/|/heads/|" >../actual
66 ) &&
67 # follow both master and side
68 git for-each-ref refs/heads >expect &&
69 test_cmp expect actual
72 test_expect_success 'by default no tags will be kept updated' '
74 cd dir_all && git fetch &&
75 git for-each-ref refs/tags >../actual
76 ) &&
77 git for-each-ref refs/tags >expect &&
78 test_must_fail test_cmp expect actual
81 test_expect_success '--single-branch while HEAD pointing at master' '
83 cd dir_master && git fetch &&
84 git for-each-ref refs/remotes/origin |
85 sed -e "/HEAD$/d" \
86 -e "s|/remotes/origin/|/heads/|" >../actual
87 ) &&
88 # only follow master
89 git for-each-ref refs/heads/master >expect &&
90 test_cmp expect actual
93 test_expect_success '--single-branch while HEAD pointing at side' '
95 cd dir_side && git fetch &&
96 git for-each-ref refs/remotes/origin |
97 sed -e "/HEAD$/d" \
98 -e "s|/remotes/origin/|/heads/|" >../actual
99 ) &&
100 # only follow side
101 git for-each-ref refs/heads/side >expect &&
102 test_cmp expect actual
105 test_expect_success '--single-branch with explicit --branch side' '
107 cd dir_side2 && git fetch &&
108 git for-each-ref refs/remotes/origin |
109 sed -e "/HEAD$/d" \
110 -e "s|/remotes/origin/|/heads/|" >../actual
111 ) &&
112 # only follow side
113 git for-each-ref refs/heads/side >expect &&
114 test_cmp expect actual
117 test_expect_success '--single-branch with explicit --branch with tag fetches updated tag' '
119 cd dir_tag && git fetch &&
120 git for-each-ref refs/tags >../actual
121 ) &&
122 git for-each-ref refs/tags >expect &&
123 test_cmp expect actual
126 test_expect_success '--single-branch with --mirror' '
128 cd dir_mirror && git fetch &&
129 git for-each-ref refs > ../actual
130 ) &&
131 git for-each-ref refs >expect &&
132 test_cmp expect actual
135 test_expect_success '--single-branch with explicit --branch and --mirror' '
137 cd dir_mirror_side && git fetch &&
138 git for-each-ref refs > ../actual
139 ) &&
140 git for-each-ref refs >expect &&
141 test_cmp expect actual
144 test_expect_success '--single-branch with detached' '
146 cd dir_detached && git fetch &&
147 git for-each-ref refs/remotes/origin |
148 sed -e "/HEAD$/d" \
149 -e "s|/remotes/origin/|/heads/|" >../actual
150 ) &&
151 # nothing
152 >expect &&
153 test_cmp expect actual
156 test_done