]>
Commit | Line | Data |
---|---|---|
a2b26acd JH |
1 | #!/bin/sh |
2 | ||
3 | test_description=clone | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
3064d5a3 JS |
7 | X= |
8 | test_have_prereq !MINGW || X=.exe | |
9 | ||
a2b26acd JH |
10 | test_expect_success setup ' |
11 | ||
12 | rm -fr .git && | |
13 | test_create_repo src && | |
14 | ( | |
bafe7631 NTND |
15 | cd src && |
16 | >file && | |
17 | git add file && | |
7f08c685 NTND |
18 | git commit -m initial && |
19 | echo 1 >file && | |
20 | git add file && | |
21 | git commit -m updated | |
a2b26acd JH |
22 | ) |
23 | ||
24 | ' | |
25 | ||
1db4a75c | 26 | test_expect_success 'clone with excess parameters (1)' ' |
a2b26acd | 27 | |
1db4a75c SP |
28 | rm -fr dst && |
29 | test_must_fail git clone -n src dst junk | |
30 | ||
31 | ' | |
32 | ||
33 | test_expect_success 'clone with excess parameters (2)' ' | |
34 | ||
35 | rm -fr dst && | |
a2b26acd JH |
36 | test_must_fail git clone -n "file://$(pwd)/src" dst junk |
37 | ||
38 | ' | |
39 | ||
5cde5989 | 40 | test_expect_success C_LOCALE_OUTPUT 'output from clone' ' |
2c3766f0 | 41 | rm -fr dst && |
68b939b2 | 42 | git clone -n "file://$(pwd)/src" dst >output 2>&1 && |
28ba96ab | 43 | test $(grep Clon output | wc -l) = 1 |
2c3766f0 AM |
44 | ' |
45 | ||
1db4a75c SP |
46 | test_expect_success 'clone does not keep pack' ' |
47 | ||
48 | rm -fr dst && | |
49 | git clone -n "file://$(pwd)/src" dst && | |
50 | ! test -f dst/file && | |
51 | ! (echo dst/.git/objects/pack/pack-* | grep "\.keep") | |
52 | ||
53 | ' | |
54 | ||
a73bc127 JS |
55 | test_expect_success 'clone checks out files' ' |
56 | ||
1db4a75c | 57 | rm -fr dst && |
a73bc127 JS |
58 | git clone src dst && |
59 | test -f dst/file | |
60 | ||
61 | ' | |
62 | ||
2beebd22 JK |
63 | test_expect_success 'clone respects GIT_WORK_TREE' ' |
64 | ||
65 | GIT_WORK_TREE=worktree git clone src bare && | |
66 | test -f bare/config && | |
67 | test -f worktree/file | |
68 | ||
69 | ' | |
70 | ||
86d26f24 NTND |
71 | test_expect_success 'clone from hooks' ' |
72 | ||
73 | test_create_repo r0 && | |
74 | cd r0 && | |
75 | test_commit initial && | |
76 | cd .. && | |
77 | git init r1 && | |
78 | cd r1 && | |
79 | cat >.git/hooks/pre-commit <<-\EOF && | |
80 | #!/bin/sh | |
81 | git clone ../r0 ../r2 | |
82 | exit 1 | |
83 | EOF | |
84 | chmod u+x .git/hooks/pre-commit && | |
85 | : >file && | |
86 | git add file && | |
87 | test_must_fail git commit -m invoke-hook && | |
88 | cd .. && | |
89 | test_cmp r0/.git/HEAD r2/.git/HEAD && | |
90 | test_cmp r0/initial.t r2/initial.t | |
91 | ||
92 | ' | |
93 | ||
2beebd22 JK |
94 | test_expect_success 'clone creates intermediate directories' ' |
95 | ||
96 | git clone src long/path/to/dst && | |
97 | test -f long/path/to/dst/file | |
98 | ||
99 | ' | |
100 | ||
101 | test_expect_success 'clone creates intermediate directories for bare repo' ' | |
102 | ||
103 | git clone --bare src long/path/to/bare/dst && | |
104 | test -f long/path/to/bare/dst/config | |
105 | ||
106 | ' | |
107 | ||
bc699afc JS |
108 | test_expect_success 'clone --mirror' ' |
109 | ||
110 | git clone --mirror src mirror && | |
111 | test -f mirror/HEAD && | |
112 | test ! -f mirror/file && | |
113 | FETCH="$(cd mirror && git config remote.origin.fetch)" && | |
114 | test "+refs/*:refs/*" = "$FETCH" && | |
115 | MIRROR="$(cd mirror && git config --bool remote.origin.mirror)" && | |
116 | test "$MIRROR" = true | |
117 | ||
118 | ' | |
119 | ||
7f08c685 NTND |
120 | test_expect_success 'clone --mirror with detached HEAD' ' |
121 | ||
122 | ( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) && | |
123 | git clone --mirror src mirror.detached && | |
124 | ( cd src && git checkout - ) && | |
125 | GIT_DIR=mirror.detached git rev-parse HEAD >actual && | |
126 | test_cmp expected actual | |
127 | ||
128 | ' | |
129 | ||
130 | test_expect_success 'clone --bare with detached HEAD' ' | |
131 | ||
132 | ( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) && | |
133 | git clone --bare src bare.detached && | |
134 | ( cd src && git checkout - ) && | |
135 | GIT_DIR=bare.detached git rev-parse HEAD >actual && | |
136 | test_cmp expected actual | |
137 | ||
138 | ' | |
139 | ||
6612f877 JS |
140 | test_expect_success 'clone --bare names the local repository <name>.git' ' |
141 | ||
142 | git clone --bare src && | |
143 | test -d src.git | |
144 | ||
145 | ' | |
146 | ||
468386a9 JS |
147 | test_expect_success 'clone --mirror does not repeat tags' ' |
148 | ||
149 | (cd src && | |
150 | git tag some-tag HEAD) && | |
151 | git clone --mirror src mirror2 && | |
152 | (cd mirror2 && | |
153 | git show-ref 2> clone.err > clone.out) && | |
c7cf9566 | 154 | ! grep Duplicate mirror2/clone.err && |
468386a9 JS |
155 | grep some-tag mirror2/clone.out |
156 | ||
157 | ' | |
158 | ||
44a68fd5 CB |
159 | test_expect_success 'clone to destination with trailing /' ' |
160 | ||
161 | git clone src target-1/ && | |
162 | T=$( cd target-1 && git rev-parse HEAD ) && | |
163 | S=$( cd src && git rev-parse HEAD ) && | |
164 | test "$T" = "$S" | |
165 | ||
166 | ' | |
167 | ||
168 | test_expect_success 'clone to destination with extra trailing /' ' | |
169 | ||
170 | git clone src target-2/// && | |
171 | T=$( cd target-2 && git rev-parse HEAD ) && | |
172 | S=$( cd src && git rev-parse HEAD ) && | |
173 | test "$T" = "$S" | |
174 | ||
175 | ' | |
176 | ||
55892d23 AP |
177 | test_expect_success 'clone to an existing empty directory' ' |
178 | mkdir target-3 && | |
179 | git clone src target-3 && | |
180 | T=$( cd target-3 && git rev-parse HEAD ) && | |
181 | S=$( cd src && git rev-parse HEAD ) && | |
182 | test "$T" = "$S" | |
183 | ' | |
184 | ||
185 | test_expect_success 'clone to an existing non-empty directory' ' | |
186 | mkdir target-4 && | |
187 | >target-4/Fakefile && | |
188 | test_must_fail git clone src target-4 | |
189 | ' | |
190 | ||
191 | test_expect_success 'clone to an existing path' ' | |
192 | >target-5 && | |
193 | test_must_fail git clone src target-5 | |
194 | ' | |
195 | ||
5cd12b85 JH |
196 | test_expect_success 'clone a void' ' |
197 | mkdir src-0 && | |
198 | ( | |
199 | cd src-0 && git init | |
200 | ) && | |
12d49966 JK |
201 | git clone "file://$(pwd)/src-0" target-6 2>err-6 && |
202 | ! grep "fatal:" err-6 && | |
5cd12b85 JH |
203 | ( |
204 | cd src-0 && test_commit A | |
205 | ) && | |
12d49966 JK |
206 | git clone "file://$(pwd)/src-0" target-7 2>err-7 && |
207 | ! grep "fatal:" err-7 && | |
5cd12b85 JH |
208 | # There is no reason to insist they are bit-for-bit |
209 | # identical, but this test should suffice for now. | |
210 | test_cmp target-6/.git/config target-7/.git/config | |
211 | ' | |
212 | ||
a9f2c136 JH |
213 | test_expect_success 'clone respects global branch.autosetuprebase' ' |
214 | ( | |
a9f2c136 | 215 | test_config="$HOME/.gitconfig" && |
a9f2c136 JH |
216 | git config -f "$test_config" branch.autosetuprebase remote && |
217 | rm -fr dst && | |
218 | git clone src dst && | |
219 | cd dst && | |
220 | actual="z$(git config branch.master.rebase)" && | |
221 | test ztrue = $actual | |
222 | ) | |
223 | ' | |
224 | ||
9d2e9420 JK |
225 | test_expect_success 'respect url-encoding of file://' ' |
226 | git init x+y && | |
730220de TR |
227 | git clone "file://$PWD/x+y" xy-url-1 && |
228 | git clone "file://$PWD/x%2By" xy-url-2 | |
229 | ' | |
230 | ||
231 | test_expect_success 'do not query-string-decode + in URLs' ' | |
232 | rm -rf x+y && | |
233 | git init "x y" && | |
234 | test_must_fail git clone "file://$PWD/x+y" xy-no-plus | |
9d2e9420 JK |
235 | ' |
236 | ||
237 | test_expect_success 'do not respect url-encoding of non-url path' ' | |
238 | git init x+y && | |
239 | test_must_fail git clone x%2By xy-regular && | |
240 | git clone x+y xy-regular | |
241 | ' | |
242 | ||
b57fb80a NTND |
243 | test_expect_success 'clone separate gitdir' ' |
244 | rm -rf dst && | |
245 | git clone --separate-git-dir realgitdir src dst && | |
b57fb80a NTND |
246 | test -d realgitdir/refs |
247 | ' | |
248 | ||
33d56fa0 | 249 | test_expect_success 'clone separate gitdir: output' ' |
c723e50d | 250 | echo "gitdir: $(pwd)/realgitdir" >expected && |
2c050e01 ÆAB |
251 | test_cmp expected dst/.git |
252 | ' | |
253 | ||
9b0ebc72 NTND |
254 | test_expect_success 'clone from .git file' ' |
255 | git clone dst/.git dst2 | |
256 | ' | |
257 | ||
0c80fdb3 PH |
258 | test_expect_success 'fetch from .git gitfile' ' |
259 | ( | |
260 | cd dst2 && | |
261 | git fetch ../dst/.git | |
262 | ) | |
263 | ' | |
264 | ||
265 | test_expect_success 'fetch from gitfile parent' ' | |
266 | ( | |
267 | cd dst2 && | |
268 | git fetch ../dst | |
269 | ) | |
270 | ' | |
271 | ||
b57fb80a NTND |
272 | test_expect_success 'clone separate gitdir where target already exists' ' |
273 | rm -rf dst && | |
274 | test_must_fail git clone --separate-git-dir realgitdir src dst | |
275 | ' | |
276 | ||
e6baf4a1 | 277 | test_expect_success 'clone --reference from original' ' |
dbc92b07 JH |
278 | git clone --shared --bare src src-1 && |
279 | git clone --bare src src-2 && | |
280 | git clone --reference=src-2 --bare src-1 target-8 && | |
281 | grep /src-2/ target-8/objects/info/alternates | |
282 | ' | |
283 | ||
284 | test_expect_success 'clone with more than one --reference' ' | |
285 | git clone --bare src src-3 && | |
286 | git clone --bare src src-4 && | |
287 | git clone --reference=src-3 --reference=src-4 src target-9 && | |
288 | grep /src-3/ target-9/.git/objects/info/alternates && | |
289 | grep /src-4/ target-9/.git/objects/info/alternates | |
290 | ' | |
291 | ||
e6baf4a1 JH |
292 | test_expect_success 'clone from original with relative alternate' ' |
293 | mkdir nest && | |
294 | git clone --bare src nest/src-5 && | |
295 | echo ../../../src/.git/objects >nest/src-5/objects/info/alternates && | |
296 | git clone --bare nest/src-5 target-10 && | |
297 | grep /src/\\.git/objects target-10/objects/info/alternates | |
298 | ' | |
299 | ||
5a7d5b68 NTND |
300 | test_expect_success 'clone checking out a tag' ' |
301 | git clone --branch=some-tag src dst.tag && | |
302 | GIT_DIR=src/.git git rev-parse some-tag >expected && | |
303 | test_cmp expected dst.tag/.git/HEAD && | |
304 | GIT_DIR=dst.tag/.git git config remote.origin.fetch >fetch.actual && | |
305 | echo "+refs/heads/*:refs/remotes/origin/*" >fetch.expected && | |
306 | test_cmp fetch.expected fetch.actual | |
307 | ' | |
308 | ||
710eb3e2 TB |
309 | setup_ssh_wrapper () { |
310 | test_expect_success 'setup ssh wrapper' ' | |
e6e7530d | 311 | cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" \ |
94b8ae5a BW |
312 | "$TRASH_DIRECTORY/ssh$X" && |
313 | GIT_SSH="$TRASH_DIRECTORY/ssh$X" && | |
710eb3e2 TB |
314 | export GIT_SSH && |
315 | export TRASH_DIRECTORY && | |
316 | >"$TRASH_DIRECTORY"/ssh-output | |
317 | ' | |
8d3d28f5 NTND |
318 | } |
319 | ||
baaf2337 | 320 | copy_ssh_wrapper_as () { |
94b8ae5a | 321 | cp "$TRASH_DIRECTORY/ssh$X" "${1%$X}$X" && |
3064d5a3 | 322 | GIT_SSH="${1%$X}$X" && |
baaf2337 | 323 | export GIT_SSH |
324 | } | |
325 | ||
8d3d28f5 | 326 | expect_ssh () { |
710eb3e2 TB |
327 | test_when_finished ' |
328 | (cd "$TRASH_DIRECTORY" && rm -f ssh-expect && >ssh-output) | |
329 | ' && | |
8d3d28f5 | 330 | { |
9f697652 TB |
331 | case "$#" in |
332 | 1) | |
8d3d28f5 | 333 | ;; |
9f697652 | 334 | 2) |
8d3d28f5 | 335 | echo "ssh: $1 git-upload-pack '$2'" |
9f697652 TB |
336 | ;; |
337 | 3) | |
338 | echo "ssh: $1 $2 git-upload-pack '$3'" | |
339 | ;; | |
340 | *) | |
341 | echo "ssh: $1 $2 git-upload-pack '$3' $4" | |
8d3d28f5 NTND |
342 | esac |
343 | } >"$TRASH_DIRECTORY/ssh-expect" && | |
344 | (cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output) | |
345 | } | |
346 | ||
710eb3e2 TB |
347 | setup_ssh_wrapper |
348 | ||
2171f3d2 | 349 | test_expect_success 'clone myhost:src uses ssh' ' |
8d3d28f5 NTND |
350 | git clone myhost:src ssh-clone && |
351 | expect_ssh myhost src | |
352 | ' | |
353 | ||
f57a8715 | 354 | test_expect_success !MINGW,!CYGWIN 'clone local path foo:bar' ' |
60003340 | 355 | cp -R src "foo:bar" && |
710eb3e2 | 356 | git clone "foo:bar" foobar && |
8d3d28f5 NTND |
357 | expect_ssh none |
358 | ' | |
359 | ||
360 | test_expect_success 'bracketed hostnames are still ssh' ' | |
8d3d28f5 | 361 | git clone "[myhost:123]:src" ssh-bracket-clone && |
d1018c24 | 362 | expect_ssh "-p 123" myhost src |
60003340 NTND |
363 | ' |
364 | ||
94b8ae5a BW |
365 | test_expect_success 'OpenSSH variant passes -4' ' |
366 | git clone -4 "[myhost:123]:src" ssh-ipv4-clone && | |
367 | expect_ssh "-4 -p 123" myhost src | |
368 | ' | |
369 | ||
370 | test_expect_success 'variant can be overriden' ' | |
371 | git -c ssh.variant=simple clone -4 "[myhost:123]:src" ssh-simple-clone && | |
372 | expect_ssh myhost src | |
373 | ' | |
374 | ||
375 | test_expect_success 'simple is treated as simple' ' | |
376 | copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" && | |
377 | git clone -4 "[myhost:123]:src" ssh-bracket-clone-simple && | |
378 | expect_ssh myhost src | |
379 | ' | |
380 | ||
381 | test_expect_success 'uplink is treated as simple' ' | |
baaf2337 | 382 | copy_ssh_wrapper_as "$TRASH_DIRECTORY/uplink" && |
383 | git clone "[myhost:123]:src" ssh-bracket-clone-uplink && | |
94b8ae5a | 384 | expect_ssh myhost src |
baaf2337 | 385 | ' |
386 | ||
387 | test_expect_success 'plink is treated specially (as putty)' ' | |
388 | copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" && | |
389 | git clone "[myhost:123]:src" ssh-bracket-clone-plink-0 && | |
390 | expect_ssh "-P 123" myhost src | |
60003340 NTND |
391 | ' |
392 | ||
baaf2337 | 393 | test_expect_success 'plink.exe is treated specially (as putty)' ' |
394 | copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" && | |
395 | git clone "[myhost:123]:src" ssh-bracket-clone-plink-1 && | |
396 | expect_ssh "-P 123" myhost src | |
397 | ' | |
398 | ||
399 | test_expect_success 'tortoiseplink is like putty, with extra arguments' ' | |
400 | copy_ssh_wrapper_as "$TRASH_DIRECTORY/tortoiseplink" && | |
401 | git clone "[myhost:123]:src" ssh-bracket-clone-plink-2 && | |
402 | expect_ssh "-batch -P 123" myhost src | |
403 | ' | |
404 | ||
e9d9a8a4 SF |
405 | test_expect_success 'double quoted plink.exe in GIT_SSH_COMMAND' ' |
406 | copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" && | |
407 | GIT_SSH_COMMAND="\"$TRASH_DIRECTORY/plink.exe\" -v" \ | |
408 | git clone "[myhost:123]:src" ssh-bracket-clone-plink-3 && | |
409 | expect_ssh "-v -P 123" myhost src | |
410 | ' | |
411 | ||
412 | SQ="'" | |
413 | test_expect_success 'single quoted plink.exe in GIT_SSH_COMMAND' ' | |
414 | copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" && | |
415 | GIT_SSH_COMMAND="$SQ$TRASH_DIRECTORY/plink.exe$SQ -v" \ | |
416 | git clone "[myhost:123]:src" ssh-bracket-clone-plink-4 && | |
417 | expect_ssh "-v -P 123" myhost src | |
418 | ' | |
419 | ||
dd33e077 SF |
420 | test_expect_success 'GIT_SSH_VARIANT overrides plink detection' ' |
421 | copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" && | |
422 | GIT_SSH_VARIANT=ssh \ | |
423 | git clone "[myhost:123]:src" ssh-bracket-clone-variant-1 && | |
424 | expect_ssh "-p 123" myhost src | |
425 | ' | |
426 | ||
427 | test_expect_success 'ssh.variant overrides plink detection' ' | |
428 | copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" && | |
429 | git -c ssh.variant=ssh \ | |
430 | clone "[myhost:123]:src" ssh-bracket-clone-variant-2 && | |
431 | expect_ssh "-p 123" myhost src | |
432 | ' | |
433 | ||
434 | test_expect_success 'GIT_SSH_VARIANT overrides plink detection to plink' ' | |
435 | GIT_SSH_VARIANT=plink \ | |
436 | git clone "[myhost:123]:src" ssh-bracket-clone-variant-3 && | |
437 | expect_ssh "-P 123" myhost src | |
438 | ' | |
439 | ||
440 | test_expect_success 'GIT_SSH_VARIANT overrides plink to tortoiseplink' ' | |
441 | GIT_SSH_VARIANT=tortoiseplink \ | |
442 | git clone "[myhost:123]:src" ssh-bracket-clone-variant-4 && | |
443 | expect_ssh "-batch -P 123" myhost src | |
444 | ' | |
445 | ||
22e5ae5c JK |
446 | test_expect_success 'clean failure on broken quoting' ' |
447 | test_must_fail \ | |
448 | env GIT_SSH_COMMAND="${SQ}plink.exe -v" \ | |
449 | git clone "[myhost:123]:src" sq-failure | |
450 | ' | |
451 | ||
baaf2337 | 452 | # Reset the GIT_SSH environment variable for clone tests. |
453 | setup_ssh_wrapper | |
454 | ||
2171f3d2 TB |
455 | counter=0 |
456 | # $1 url | |
457 | # $2 none|host | |
458 | # $3 path | |
459 | test_clone_url () { | |
460 | counter=$(($counter + 1)) | |
461 | test_might_fail git clone "$1" tmp$counter && | |
9f697652 TB |
462 | shift && |
463 | expect_ssh "$@" | |
2171f3d2 TB |
464 | } |
465 | ||
f57a8715 | 466 | test_expect_success !MINGW 'clone c:temp is ssl' ' |
2171f3d2 TB |
467 | test_clone_url c:temp c temp |
468 | ' | |
469 | ||
470 | test_expect_success MINGW 'clone c:temp is dos drive' ' | |
471 | test_clone_url c:temp none | |
472 | ' | |
473 | ||
474 | #ip v4 | |
6a599748 | 475 | for repo in rep rep/home/project 123 |
2171f3d2 TB |
476 | do |
477 | test_expect_success "clone host:$repo" ' | |
478 | test_clone_url host:$repo host $repo | |
479 | ' | |
480 | done | |
481 | ||
482 | #ipv6 | |
2171f3d2 TB |
483 | for repo in rep rep/home/project 123 |
484 | do | |
485 | test_expect_success "clone [::1]:$repo" ' | |
9f697652 | 486 | test_clone_url [::1]:$repo ::1 "$repo" |
2171f3d2 TB |
487 | ' |
488 | done | |
c59ab2e5 TB |
489 | #home directory |
490 | test_expect_success "clone host:/~repo" ' | |
491 | test_clone_url host:/~repo host "~repo" | |
492 | ' | |
493 | ||
494 | test_expect_success "clone [::1]:/~repo" ' | |
495 | test_clone_url [::1]:/~repo ::1 "~repo" | |
496 | ' | |
2171f3d2 TB |
497 | |
498 | # Corner cases | |
83b05875 | 499 | for url in foo/bar:baz [foo]bar/baz:qux [foo/bar]:baz |
2171f3d2 TB |
500 | do |
501 | test_expect_success "clone $url is not ssh" ' | |
502 | test_clone_url $url none | |
503 | ' | |
504 | done | |
505 | ||
506 | #with ssh:// scheme | |
6b6c5f7a TB |
507 | #ignore trailing colon |
508 | for tcol in "" : | |
509 | do | |
510 | test_expect_success "clone ssh://host.xz$tcol/home/user/repo" ' | |
511 | test_clone_url "ssh://host.xz$tcol/home/user/repo" host.xz /home/user/repo | |
512 | ' | |
513 | # from home directory | |
514 | test_expect_success "clone ssh://host.xz$tcol/~repo" ' | |
515 | test_clone_url "ssh://host.xz$tcol/~repo" host.xz "~repo" | |
2171f3d2 | 516 | ' |
6b6c5f7a | 517 | done |
2171f3d2 TB |
518 | |
519 | # with port number | |
520 | test_expect_success 'clone ssh://host.xz:22/home/user/repo' ' | |
521 | test_clone_url "ssh://host.xz:22/home/user/repo" "-p 22 host.xz" "/home/user/repo" | |
522 | ' | |
523 | ||
524 | # from home directory with port number | |
525 | test_expect_success 'clone ssh://host.xz:22/~repo' ' | |
526 | test_clone_url "ssh://host.xz:22/~repo" "-p 22 host.xz" "~repo" | |
527 | ' | |
528 | ||
529 | #IPv6 | |
6b6c5f7a | 530 | for tuah in ::1 [::1] [::1]: user@::1 user@[::1] user@[::1]: [user@::1] [user@::1]: |
9f697652 | 531 | do |
a75a3081 | 532 | ehost=$(echo $tuah | sed -e "s/1]:/1]/" | tr -d "[]") |
9f697652 TB |
533 | test_expect_success "clone ssh://$tuah/home/user/repo" " |
534 | test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo | |
535 | " | |
536 | done | |
2171f3d2 TB |
537 | |
538 | #IPv6 from home directory | |
9f697652 TB |
539 | for tuah in ::1 [::1] user@::1 user@[::1] [user@::1] |
540 | do | |
541 | euah=$(echo $tuah | tr -d "[]") | |
542 | test_expect_success "clone ssh://$tuah/~repo" " | |
543 | test_clone_url ssh://$tuah/~repo $euah '~repo' | |
544 | " | |
545 | done | |
2171f3d2 TB |
546 | |
547 | #IPv6 with port number | |
9f697652 TB |
548 | for tuah in [::1] user@[::1] [user@::1] |
549 | do | |
550 | euah=$(echo $tuah | tr -d "[]") | |
551 | test_expect_success "clone ssh://$tuah:22/home/user/repo" " | |
552 | test_clone_url ssh://$tuah:22/home/user/repo '-p 22' $euah /home/user/repo | |
553 | " | |
554 | done | |
2171f3d2 TB |
555 | |
556 | #IPv6 from home directory with port number | |
9f697652 TB |
557 | for tuah in [::1] user@[::1] [user@::1] |
558 | do | |
559 | euah=$(echo $tuah | tr -d "[]") | |
560 | test_expect_success "clone ssh://$tuah:22/~repo" " | |
561 | test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo' | |
562 | " | |
563 | done | |
2171f3d2 | 564 | |
8b277222 JH |
565 | test_expect_success 'clone from a repository with two identical branches' ' |
566 | ||
567 | ( | |
568 | cd src && | |
569 | git checkout -b another master | |
570 | ) && | |
571 | git clone src target-11 && | |
572 | test "z$( cd target-11 && git symbolic-ref HEAD )" = zrefs/heads/another | |
573 | ||
574 | ' | |
575 | ||
0d7d285f NTND |
576 | test_expect_success 'shallow clone locally' ' |
577 | git clone --depth=1 --no-local src ssrrcc && | |
578 | git clone ssrrcc ddsstt && | |
579 | test_cmp ssrrcc/.git/shallow ddsstt/.git/shallow && | |
580 | ( cd ddsstt && git fsck ) | |
581 | ' | |
582 | ||
32359838 JK |
583 | test_expect_success 'GIT_TRACE_PACKFILE produces a usable pack' ' |
584 | rm -rf dst.git && | |
585 | GIT_TRACE_PACKFILE=$PWD/tmp.pack git clone --no-local --bare src dst.git && | |
586 | git init --bare replay.git && | |
587 | git -C replay.git index-pack -v --stdin <tmp.pack | |
588 | ' | |
589 | ||
a2b26acd | 590 | test_done |