]>
Commit | Line | Data |
---|---|---|
a2b26acd JH |
1 | #!/bin/sh |
2 | ||
3 | test_description=clone | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | test_expect_success setup ' | |
8 | ||
9 | rm -fr .git && | |
10 | test_create_repo src && | |
11 | ( | |
12 | cd src | |
13 | >file | |
14 | git add file | |
15 | git commit -m initial | |
16 | ) | |
17 | ||
18 | ' | |
19 | ||
1db4a75c | 20 | test_expect_success 'clone with excess parameters (1)' ' |
a2b26acd | 21 | |
1db4a75c SP |
22 | rm -fr dst && |
23 | test_must_fail git clone -n src dst junk | |
24 | ||
25 | ' | |
26 | ||
27 | test_expect_success 'clone with excess parameters (2)' ' | |
28 | ||
29 | rm -fr dst && | |
a2b26acd JH |
30 | test_must_fail git clone -n "file://$(pwd)/src" dst junk |
31 | ||
32 | ' | |
33 | ||
1db4a75c SP |
34 | test_expect_success 'clone does not keep pack' ' |
35 | ||
36 | rm -fr dst && | |
37 | git clone -n "file://$(pwd)/src" dst && | |
38 | ! test -f dst/file && | |
39 | ! (echo dst/.git/objects/pack/pack-* | grep "\.keep") | |
40 | ||
41 | ' | |
42 | ||
a73bc127 JS |
43 | test_expect_success 'clone checks out files' ' |
44 | ||
1db4a75c | 45 | rm -fr dst && |
a73bc127 JS |
46 | git clone src dst && |
47 | test -f dst/file | |
48 | ||
49 | ' | |
50 | ||
2beebd22 JK |
51 | test_expect_success 'clone respects GIT_WORK_TREE' ' |
52 | ||
53 | GIT_WORK_TREE=worktree git clone src bare && | |
54 | test -f bare/config && | |
55 | test -f worktree/file | |
56 | ||
57 | ' | |
58 | ||
59 | test_expect_success 'clone creates intermediate directories' ' | |
60 | ||
61 | git clone src long/path/to/dst && | |
62 | test -f long/path/to/dst/file | |
63 | ||
64 | ' | |
65 | ||
66 | test_expect_success 'clone creates intermediate directories for bare repo' ' | |
67 | ||
68 | git clone --bare src long/path/to/bare/dst && | |
69 | test -f long/path/to/bare/dst/config | |
70 | ||
71 | ' | |
72 | ||
bc699afc JS |
73 | test_expect_success 'clone --mirror' ' |
74 | ||
75 | git clone --mirror src mirror && | |
76 | test -f mirror/HEAD && | |
77 | test ! -f mirror/file && | |
78 | FETCH="$(cd mirror && git config remote.origin.fetch)" && | |
79 | test "+refs/*:refs/*" = "$FETCH" && | |
80 | MIRROR="$(cd mirror && git config --bool remote.origin.mirror)" && | |
81 | test "$MIRROR" = true | |
82 | ||
83 | ' | |
84 | ||
a2b26acd | 85 | test_done |