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
16 test_expect_success
'local clone without .git suffix' '
18 git clone -l -s a b &&
20 test "$(GIT_CONFIG=.git/config git config --bool core.bare)" = false &&
24 test_expect_success
'local clone with .git suffix' '
26 git clone -l -s a.git c &&
31 test_expect_success
'local clone from x' '
33 git clone -l -s x y &&
38 test_expect_success
'local clone from x.git that does not exist' '
40 if git clone -l -s x.git z
42 echo "Oops, should have failed"
49 test_expect_success
'With -no-hardlinks, local will make a copy' '
51 git clone --bare --no-hardlinks x w &&
53 linked=$(find objects -type f ! -links 1 | wc -l) &&
57 test_expect_success
'Even without -l, local will make a hardlink' '
60 git clone -l --bare x w &&
62 copied=$(find objects -type f -links 1 | wc -l) &&
66 test_expect_success
'local clone of repo with nonexistent ref in HEAD' '
68 echo "ref: refs/heads/nonexistent" > a.git/HEAD &&
72 test ! -e .git/refs/remotes/origin/HEAD'