3 test_description
='test local clone'
8 test_expect_success
'preparing origin repository' '
9 : >file && git add . && git commit -m1 &&
10 git clone --bare . a.git &&
11 git clone --bare . x &&
12 test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true &&
13 test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true
14 git bundle create b1.bundle --all &&
15 git bundle create b2.bundle master &&
21 test_expect_success
'local clone without .git suffix' '
23 git clone -l -s a b &&
25 test "$(GIT_CONFIG=.git/config git config --bool core.bare)" = false &&
29 test_expect_success
'local clone with .git suffix' '
31 git clone -l -s a.git c &&
36 test_expect_success
'local clone from x' '
38 git clone -l -s x y &&
43 test_expect_success
'local clone from x.git that does not exist' '
45 if git clone -l -s x.git z
47 echo "Oops, should have failed"
54 test_expect_success
'With -no-hardlinks, local will make a copy' '
56 git clone --bare --no-hardlinks x w &&
58 linked=$(find objects -type f ! -links 1 | wc -l) &&
62 test_expect_success
'Even without -l, local will make a hardlink' '
65 git clone -l --bare x w &&
67 copied=$(find objects -type f -links 1 | wc -l) &&
71 test_expect_success
'local clone of repo with nonexistent ref in HEAD' '
73 echo "ref: refs/heads/nonexistent" > a.git/HEAD &&
77 test ! -e .git/refs/remotes/origin/HEAD'
79 test_expect_success
'bundle clone without .bundle suffix' '
86 test_expect_success
'bundle clone with .bundle suffix' '
88 git clone b1.bundle &&
93 test_expect_success
'bundle clone from b4' '
100 test_expect_success
'bundle clone from b4.bundle that does not exist' '
102 if git clone b4.bundle bb
104 echo "Oops, should have failed"
111 test_expect_success
'bundle clone with nonexistent HEAD' '
113 git clone b2.bundle b2 &&
116 test ! -e .git/refs/heads/master
119 test_expect_success
'clone empty repository' '
122 (cd empty && git init) &&
123 git clone empty empty-clone &&
126 echo "content" >> foo &&
128 git commit -m "Initial commit" &&
129 git push origin master &&
130 expected=$(git rev-parse master) &&
131 actual=$(git --git-dir=../empty/.git rev-parse master) &&
132 test $actual = $expected)