]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5601-clone.sh
GIT 1.6.0-rc2
[thirdparty/git.git] / t / t5601-clone.sh
CommitLineData
a2b26acd
JH
1#!/bin/sh
2
3test_description=clone
4
5. ./test-lib.sh
6
7test_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 20test_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
27test_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
2c3766f0
AM
34test_expect_success 'output from clone' '
35 rm -fr dst &&
36 git clone -n "file://$(pwd)/src" dst >output &&
37 test $(grep Initialized output | wc -l) = 1
38'
39
1db4a75c
SP
40test_expect_success 'clone does not keep pack' '
41
42 rm -fr dst &&
43 git clone -n "file://$(pwd)/src" dst &&
44 ! test -f dst/file &&
45 ! (echo dst/.git/objects/pack/pack-* | grep "\.keep")
46
47'
48
a73bc127
JS
49test_expect_success 'clone checks out files' '
50
1db4a75c 51 rm -fr dst &&
a73bc127
JS
52 git clone src dst &&
53 test -f dst/file
54
55'
56
2beebd22
JK
57test_expect_success 'clone respects GIT_WORK_TREE' '
58
59 GIT_WORK_TREE=worktree git clone src bare &&
60 test -f bare/config &&
61 test -f worktree/file
62
63'
64
65test_expect_success 'clone creates intermediate directories' '
66
67 git clone src long/path/to/dst &&
68 test -f long/path/to/dst/file
69
70'
71
72test_expect_success 'clone creates intermediate directories for bare repo' '
73
74 git clone --bare src long/path/to/bare/dst &&
75 test -f long/path/to/bare/dst/config
76
77'
78
bc699afc
JS
79test_expect_success 'clone --mirror' '
80
81 git clone --mirror src mirror &&
82 test -f mirror/HEAD &&
83 test ! -f mirror/file &&
84 FETCH="$(cd mirror && git config remote.origin.fetch)" &&
85 test "+refs/*:refs/*" = "$FETCH" &&
86 MIRROR="$(cd mirror && git config --bool remote.origin.mirror)" &&
87 test "$MIRROR" = true
88
89'
90
6612f877
JS
91test_expect_success 'clone --bare names the local repository <name>.git' '
92
93 git clone --bare src &&
94 test -d src.git
95
96'
97
a2b26acd 98test_done