Teach git diff about Objective-C syntax
[git/jnareb-git/bp-gitweb.git] / t / t5701-clone-local.sh
blob8dfaaa456e115e85e36c438bb998d8053534104e
1 #!/bin/sh
3 test_description='test local clone'
4 . ./test-lib.sh
6 D=`pwd`
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 HEAD &&
15 git bundle create b2.bundle --all &&
16 mkdir dir &&
17 cp b1.bundle dir/b3
18 cp b1.bundle b4
21 test_expect_success 'local clone without .git suffix' '
22 cd "$D" &&
23 git clone -l -s a b &&
24 cd b &&
25 test "$(GIT_CONFIG=.git/config git config --bool core.bare)" = false &&
26 git fetch
29 test_expect_success 'local clone with .git suffix' '
30 cd "$D" &&
31 git clone -l -s a.git c &&
32 cd c &&
33 git fetch
36 test_expect_success 'local clone from x' '
37 cd "$D" &&
38 git clone -l -s x y &&
39 cd y &&
40 git fetch
43 test_expect_success 'local clone from x.git that does not exist' '
44 cd "$D" &&
45 if git clone -l -s x.git z
46 then
47 echo "Oops, should have failed"
48 false
49 else
50 echo happy
54 test_expect_success 'With -no-hardlinks, local will make a copy' '
55 cd "$D" &&
56 git clone --bare --no-hardlinks x w &&
57 cd w &&
58 linked=$(find objects -type f ! -links 1 | wc -l) &&
59 test 0 = $linked
62 test_expect_success 'Even without -l, local will make a hardlink' '
63 cd "$D" &&
64 rm -fr w &&
65 git clone -l --bare x w &&
66 cd w &&
67 copied=$(find objects -type f -links 1 | wc -l) &&
68 test 0 = $copied
71 test_expect_success 'local clone of repo with nonexistent ref in HEAD' '
72 cd "$D" &&
73 echo "ref: refs/heads/nonexistent" > a.git/HEAD &&
74 git clone a d &&
75 cd d &&
76 git fetch &&
77 test ! -e .git/refs/remotes/origin/HEAD'
79 test_expect_success 'bundle clone without .bundle suffix' '
80 cd "$D" &&
81 git clone dir/b3 &&
82 cd b3 &&
83 git fetch
86 test_expect_success 'bundle clone with .bundle suffix' '
87 cd "$D" &&
88 git clone b1.bundle &&
89 cd b1 &&
90 git fetch
93 test_expect_success 'bundle clone from b4' '
94 cd "$D" &&
95 git clone b4 bdl &&
96 cd bdl &&
97 git fetch
100 test_expect_success 'bundle clone from b4.bundle that does not exist' '
101 cd "$D" &&
102 if git clone b4.bundle bb
103 then
104 echo "Oops, should have failed"
105 false
106 else
107 echo happy
111 test_expect_success 'bundle clone with nonexistent HEAD' '
112 cd "$D" &&
113 git clone b2.bundle b2 &&
114 cd b2 &&
115 git fetch
116 test ! -e .git/refs/heads/master
119 test_done