3 test_description
='clone --branch option'
7 echo refs
/heads
/"$1" >expect
&&
8 git symbolic-ref HEAD
>actual
&&
17 test_expect_success
'setup' '
19 (cd parent && git init &&
20 echo one >file && git add file && git commit -m one &&
21 git checkout -b two &&
22 echo two >file && git add file && git commit -m two &&
23 git checkout master) &&
25 (cd empty && git init)
28 test_expect_success
'vanilla clone chooses HEAD' '
29 git clone parent clone &&
36 test_expect_success
'clone -b chooses specified branch' '
37 git clone -b two parent clone-two &&
44 test_expect_success
'clone -b sets up tracking' '
46 echo origin >expect &&
47 git config branch.two.remote >actual &&
48 echo refs/heads/two >>expect &&
49 git config branch.two.merge >>actual &&
50 test_cmp expect actual
54 test_expect_success
'clone -b does not munge remotes/origin/HEAD' '
56 echo refs/remotes/origin/master >expect &&
57 git symbolic-ref refs/remotes/origin/HEAD >actual &&
58 test_cmp expect actual
62 test_expect_success
'clone -b with bogus branch' '
63 test_must_fail git clone -b bogus parent clone-bogus
66 test_expect_success
'clone -b not allowed with empty repos' '
67 test_must_fail git clone -b branch empty clone-branch-empty