5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
11 test_have_prereq
!MINGW || X
=.exe
13 test_expect_success setup
'
16 test_create_repo src &&
21 git commit -m initial &&
29 test_expect_success
'clone with excess parameters (1)' '
32 test_must_fail git clone -n src dst junk
36 test_expect_success
'clone with excess parameters (2)' '
39 test_must_fail git clone -n "file://$(pwd)/src" dst junk
43 test_expect_success
'output from clone' '
45 git clone -n "file://$(pwd)/src" dst >output 2>&1 &&
46 test $(grep Clon output | wc -l) = 1
49 test_expect_success
'clone does not keep pack' '
52 git clone -n "file://$(pwd)/src" dst &&
54 ! (echo dst/.git/objects/pack/pack-* | grep "\.keep")
58 test_expect_success
'clone checks out files' '
66 test_expect_success
'clone respects GIT_WORK_TREE' '
68 GIT_WORK_TREE=worktree git clone src bare &&
69 test -f bare/config &&
74 test_expect_success LIBCURL
'clone warns or fails when using username:password' '
75 message="URL '\''https://username:<redacted>@localhost/'\'' uses plaintext credentials" &&
76 test_must_fail git -c transfer.credentialsInUrl=allow clone https://username:password@localhost attempt1 2>err &&
77 ! grep "$message" err &&
79 test_must_fail git -c transfer.credentialsInUrl=warn clone https://username:password@localhost attempt2 2>err &&
80 grep "warning: $message" err >warnings &&
81 test_line_count = 2 warnings &&
83 test_must_fail git -c transfer.credentialsInUrl=die clone https://username:password@localhost attempt3 2>err &&
84 grep "fatal: $message" err >warnings &&
85 test_line_count = 1 warnings &&
87 test_must_fail git -c transfer.credentialsInUrl=die clone https://username:@localhost attempt3 2>err &&
88 grep "fatal: $message" err >warnings &&
89 test_line_count = 1 warnings
92 test_expect_success LIBCURL
'clone does not detect username:password when it is https://username@domain:port/' '
93 test_must_fail git -c transfer.credentialsInUrl=warn clone https://username@localhost:8080 attempt3 2>err &&
94 ! grep "uses plaintext credentials" err
97 test_expect_success
'clone from hooks' '
99 test_create_repo r0 &&
101 test_commit initial &&
105 test_hook pre-commit <<-\EOF &&
106 git clone ../r0 ../r2
111 test_must_fail git commit -m invoke-hook &&
113 test_cmp r0/.git/HEAD r2/.git/HEAD &&
114 test_cmp r0/initial.t r2/initial.t
118 test_expect_success
'clone creates intermediate directories' '
120 git clone src long/path/to/dst &&
121 test -f long/path/to/dst/file
125 test_expect_success
'clone creates intermediate directories for bare repo' '
127 git clone --bare src long/path/to/bare/dst &&
128 test -f long/path/to/bare/dst/config
132 test_expect_success
'clone --mirror' '
134 git clone --mirror src mirror &&
135 test -f mirror/HEAD &&
136 test ! -f mirror/file &&
137 FETCH="$(cd mirror && git config remote.origin.fetch)" &&
138 test "+refs/*:refs/*" = "$FETCH" &&
139 MIRROR="$(cd mirror && git config --bool remote.origin.mirror)" &&
140 test "$MIRROR" = true
144 test_expect_success
'clone --mirror with detached HEAD' '
146 ( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) &&
147 git clone --mirror src mirror.detached &&
148 ( cd src && git checkout - ) &&
149 GIT_DIR=mirror.detached git rev-parse HEAD >actual &&
150 test_cmp expected actual
154 test_expect_success
'clone --bare with detached HEAD' '
156 ( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) &&
157 git clone --bare src bare.detached &&
158 ( cd src && git checkout - ) &&
159 GIT_DIR=bare.detached git rev-parse HEAD >actual &&
160 test_cmp expected actual
164 test_expect_success
'clone --bare names the local repository <name>.git' '
166 git clone --bare src &&
171 test_expect_success
'clone --mirror does not repeat tags' '
174 git tag some-tag HEAD) &&
175 git clone --mirror src mirror2 &&
177 git show-ref 2> clone.err > clone.out) &&
178 ! grep Duplicate mirror2/clone.err &&
179 grep some-tag mirror2/clone.out
183 test_expect_success
'clone to destination with trailing /' '
185 git clone src target-1/ &&
186 T=$( cd target-1 && git rev-parse HEAD ) &&
187 S=$( cd src && git rev-parse HEAD ) &&
192 test_expect_success
'clone to destination with extra trailing /' '
194 git clone src target-2/// &&
195 T=$( cd target-2 && git rev-parse HEAD ) &&
196 S=$( cd src && git rev-parse HEAD ) &&
201 test_expect_success
'clone to an existing empty directory' '
203 git clone src target-3 &&
204 T=$( cd target-3 && git rev-parse HEAD ) &&
205 S=$( cd src && git rev-parse HEAD ) &&
209 test_expect_success
'clone to an existing non-empty directory' '
211 >target-4/Fakefile &&
212 test_must_fail git clone src target-4
215 test_expect_success
'clone to an existing path' '
217 test_must_fail git clone src target-5
220 test_expect_success
'clone a void' '
225 git clone "file://$(pwd)/src-0" target-6 2>err-6 &&
226 ! grep "fatal:" err-6 &&
228 cd src-0 && test_commit A
230 git clone "file://$(pwd)/src-0" target-7 2>err-7 &&
231 ! grep "fatal:" err-7 &&
232 # There is no reason to insist they are bit-for-bit
233 # identical, but this test should suffice for now.
234 test_cmp target-6/.git/config target-7/.git/config
237 test_expect_success
'clone respects global branch.autosetuprebase' '
239 test_config="$HOME/.gitconfig" &&
240 git config -f "$test_config" branch.autosetuprebase remote &&
244 actual="z$(git config branch.main.rebase)" &&
249 test_expect_success
'respect url-encoding of file://' '
251 git clone "file://$PWD/x+y" xy-url-1 &&
252 git clone "file://$PWD/x%2By" xy-url-2
255 test_expect_success
'do not query-string-decode + in URLs' '
258 test_must_fail git clone "file://$PWD/x+y" xy-no-plus
261 test_expect_success
'do not respect url-encoding of non-url path' '
263 test_must_fail git clone x%2By xy-regular &&
264 git clone x+y xy-regular
267 test_expect_success
'clone separate gitdir' '
269 git clone --separate-git-dir realgitdir src dst &&
270 test -d realgitdir/refs
273 test_expect_success
'clone separate gitdir: output' '
274 echo "gitdir: $(pwd)/realgitdir" >expected &&
275 test_cmp expected dst/.git
278 test_expect_success
'clone from .git file' '
279 git clone dst/.git dst2
282 test_expect_success
'fetch from .git gitfile' '
285 git fetch ../dst/.git
289 test_expect_success
'fetch from gitfile parent' '
296 test_expect_success
'clone separate gitdir where target already exists' '
298 echo foo=bar >>realgitdir/config &&
299 test_must_fail git clone --separate-git-dir realgitdir src dst &&
300 grep foo=bar realgitdir/config
303 test_expect_success
'clone --reference from original' '
304 git clone --shared --bare src src-1 &&
305 git clone --bare src src-2 &&
306 git clone --reference=src-2 --bare src-1 target-8 &&
307 grep /src-2/ target-8/objects/info/alternates
310 test_expect_success
'clone with more than one --reference' '
311 git clone --bare src src-3 &&
312 git clone --bare src src-4 &&
313 git clone --reference=src-3 --reference=src-4 src target-9 &&
314 grep /src-3/ target-9/.git/objects/info/alternates &&
315 grep /src-4/ target-9/.git/objects/info/alternates
318 test_expect_success
'clone from original with relative alternate' '
320 git clone --bare src nest/src-5 &&
321 echo ../../../src/.git/objects >nest/src-5/objects/info/alternates &&
322 git clone --bare nest/src-5 target-10 &&
323 grep /src/\\.git/objects target-10/objects/info/alternates
326 test_expect_success
'clone checking out a tag' '
327 git clone --branch=some-tag src dst.tag &&
328 GIT_DIR=src/.git git rev-parse some-tag >expected &&
329 GIT_DIR=dst.tag/.git git rev-parse HEAD >actual &&
330 test_cmp expected actual &&
331 GIT_DIR=dst.tag/.git git config remote.origin.fetch >fetch.actual &&
332 echo "+refs/heads/*:refs/remotes/origin/*" >fetch.expected &&
333 test_cmp fetch.expected fetch.actual
336 test_expect_success
'set up ssh wrapper' '
337 cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" \
338 "$TRASH_DIRECTORY/ssh$X" &&
339 GIT_SSH="$TRASH_DIRECTORY/ssh$X" &&
341 export TRASH_DIRECTORY &&
342 >"$TRASH_DIRECTORY"/ssh-output
345 copy_ssh_wrapper_as
() {
347 cp "$TRASH_DIRECTORY/ssh$X" "${1%$X}$X" &&
348 test_when_finished
"rm $(git rev-parse --sq-quote "${1%$X}$X")" &&
349 GIT_SSH
="${1%$X}$X" &&
350 test_when_finished
"GIT_SSH=\"\$TRASH_DIRECTORY/ssh\$X\""
355 (cd "$TRASH_DIRECTORY" && rm -f ssh-expect && >ssh-output)
362 echo "ssh: $1 git-upload-pack '$2'"
365 echo "ssh: $1 $2 git-upload-pack '$3'"
368 echo "ssh: $1 $2 git-upload-pack '$3' $4"
370 } >"$TRASH_DIRECTORY/ssh-expect" &&
371 (cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output
)
374 test_expect_success
'clone myhost:src uses ssh' '
375 GIT_TEST_PROTOCOL_VERSION=0 git clone myhost:src ssh-clone &&
376 expect_ssh myhost src
379 test_expect_success
!MINGW
,!CYGWIN
'clone local path foo:bar' '
380 cp -R src "foo:bar" &&
381 git clone "foo:bar" foobar &&
385 test_expect_success
'bracketed hostnames are still ssh' '
386 GIT_TEST_PROTOCOL_VERSION=0 git clone "[myhost:123]:src" ssh-bracket-clone &&
387 expect_ssh "-p 123" myhost src
390 test_expect_success
'OpenSSH variant passes -4' '
391 GIT_TEST_PROTOCOL_VERSION=0 git clone -4 "[myhost:123]:src" ssh-ipv4-clone &&
392 expect_ssh "-4 -p 123" myhost src
395 test_expect_success
'variant can be overridden' '
396 copy_ssh_wrapper_as "$TRASH_DIRECTORY/putty" &&
397 git -c ssh.variant=putty clone -4 "[myhost:123]:src" ssh-putty-clone &&
398 expect_ssh "-4 -P 123" myhost src
401 test_expect_success
'variant=auto picks based on basename' '
402 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
403 git -c ssh.variant=auto clone -4 "[myhost:123]:src" ssh-auto-clone &&
404 expect_ssh "-4 -P 123" myhost src
407 test_expect_success
'simple does not support -4/-6' '
408 copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" &&
409 test_must_fail git clone -4 "myhost:src" ssh-4-clone-simple
412 test_expect_success
'simple does not support port' '
413 copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" &&
414 test_must_fail git clone "[myhost:123]:src" ssh-bracket-clone-simple
417 test_expect_success
'uplink is treated as simple' '
418 copy_ssh_wrapper_as "$TRASH_DIRECTORY/uplink" &&
419 test_must_fail git clone "[myhost:123]:src" ssh-bracket-clone-uplink &&
420 git clone "myhost:src" ssh-clone-uplink &&
421 expect_ssh myhost src
424 test_expect_success
'OpenSSH-like uplink is treated as ssh' '
425 write_script "$TRASH_DIRECTORY/uplink" <<-EOF &&
430 exec "\$TRASH_DIRECTORY/ssh$X" "\$@"
432 test_when_finished "rm -f \"\$TRASH_DIRECTORY/uplink\"" &&
433 GIT_SSH="$TRASH_DIRECTORY/uplink" &&
434 test_when_finished "GIT_SSH=\"\$TRASH_DIRECTORY/ssh\$X\"" &&
435 GIT_TEST_PROTOCOL_VERSION=0 git clone "[myhost:123]:src" ssh-bracket-clone-sshlike-uplink &&
436 expect_ssh "-p 123" myhost src
439 test_expect_success
'plink is treated specially (as putty)' '
440 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
441 git clone "[myhost:123]:src" ssh-bracket-clone-plink-0 &&
442 expect_ssh "-P 123" myhost src
445 test_expect_success
'plink.exe is treated specially (as putty)' '
446 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" &&
447 git clone "[myhost:123]:src" ssh-bracket-clone-plink-1 &&
448 expect_ssh "-P 123" myhost src
451 test_expect_success
'tortoiseplink is like putty, with extra arguments' '
452 copy_ssh_wrapper_as "$TRASH_DIRECTORY/tortoiseplink" &&
453 git clone "[myhost:123]:src" ssh-bracket-clone-plink-2 &&
454 expect_ssh "-batch -P 123" myhost src
457 test_expect_success
'double quoted plink.exe in GIT_SSH_COMMAND' '
458 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" &&
459 GIT_SSH_COMMAND="\"$TRASH_DIRECTORY/plink.exe\" -v" \
460 git clone "[myhost:123]:src" ssh-bracket-clone-plink-3 &&
461 expect_ssh "-v -P 123" myhost src
464 test_expect_success
'single quoted plink.exe in GIT_SSH_COMMAND' '
465 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" &&
466 GIT_SSH_COMMAND="$SQ$TRASH_DIRECTORY/plink.exe$SQ -v" \
467 git clone "[myhost:123]:src" ssh-bracket-clone-plink-4 &&
468 expect_ssh "-v -P 123" myhost src
471 test_expect_success
'GIT_SSH_VARIANT overrides plink detection' '
472 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
473 GIT_TEST_PROTOCOL_VERSION=0 GIT_SSH_VARIANT=ssh \
474 git clone "[myhost:123]:src" ssh-bracket-clone-variant-1 &&
475 expect_ssh "-p 123" myhost src
478 test_expect_success
'ssh.variant overrides plink detection' '
479 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
480 GIT_TEST_PROTOCOL_VERSION=0 git -c ssh.variant=ssh \
481 clone "[myhost:123]:src" ssh-bracket-clone-variant-2 &&
482 expect_ssh "-p 123" myhost src
485 test_expect_success
'GIT_SSH_VARIANT overrides plink detection to plink' '
486 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
487 GIT_SSH_VARIANT=plink \
488 git clone "[myhost:123]:src" ssh-bracket-clone-variant-3 &&
489 expect_ssh "-P 123" myhost src
492 test_expect_success
'GIT_SSH_VARIANT overrides plink to tortoiseplink' '
493 copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
494 GIT_SSH_VARIANT=tortoiseplink \
495 git clone "[myhost:123]:src" ssh-bracket-clone-variant-4 &&
496 expect_ssh "-batch -P 123" myhost src
499 test_expect_success
'clean failure on broken quoting' '
501 env GIT_SSH_COMMAND="${SQ}plink.exe -v" \
502 git clone "[myhost:123]:src" sq-failure
510 counter
=$
(($counter + 1))
511 test_might_fail env GIT_TEST_PROTOCOL_VERSION
=0 git clone
"$1" tmp
$counter &&
516 test_expect_success
!MINGW
,!CYGWIN
'clone c:temp is ssl' '
517 test_clone_url c:temp c temp
520 test_expect_success MINGW
'clone c:temp is dos drive' '
521 test_clone_url c:temp none
525 for repo
in rep rep
/home
/project
123
527 test_expect_success
"clone host:$repo" '
528 test_clone_url host:$repo host $repo
533 for repo
in rep rep
/home
/project
123
535 test_expect_success
"clone [::1]:$repo" '
536 test_clone_url [::1]:$repo ::1 "$repo"
540 test_expect_success
"clone host:/~repo" '
541 test_clone_url host:/~repo host "~repo"
544 test_expect_success
"clone [::1]:/~repo" '
545 test_clone_url [::1]:/~repo ::1 "~repo"
549 for url
in foo
/bar
:baz
[foo
]bar
/baz
:qux
[foo
/bar
]:baz
551 test_expect_success
"clone $url is not ssh" '
552 test_clone_url $url none
557 #ignore trailing colon
560 test_expect_success
"clone ssh://host.xz$tcol/home/user/repo" '
561 test_clone_url "ssh://host.xz$tcol/home/user/repo" host.xz /home/user/repo
563 # from home directory
564 test_expect_success
"clone ssh://host.xz$tcol/~repo" '
565 test_clone_url "ssh://host.xz$tcol/~repo" host.xz "~repo"
570 test_expect_success
'clone ssh://host.xz:22/home/user/repo' '
571 test_clone_url "ssh://host.xz:22/home/user/repo" "-p 22 host.xz" "/home/user/repo"
574 # from home directory with port number
575 test_expect_success
'clone ssh://host.xz:22/~repo' '
576 test_clone_url "ssh://host.xz:22/~repo" "-p 22 host.xz" "~repo"
580 for tuah
in ::1 [::1] [::1]: user@
::1 user@
[::1] user@
[::1]: [user@
::1] [user@
::1]:
582 ehost
=$
(echo $tuah |
sed -e "s/1]:/1]/" |
tr -d "[]")
583 test_expect_success
"clone ssh://$tuah/home/user/repo" "
584 test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo
588 #IPv6 from home directory
589 for tuah
in ::1 [::1] user@
::1 user@
[::1] [user@
::1]
591 euah
=$
(echo $tuah |
tr -d "[]")
592 test_expect_success
"clone ssh://$tuah/~repo" "
593 test_clone_url ssh://$tuah/~repo $euah '~repo'
597 #IPv6 with port number
598 for tuah
in [::1] user@
[::1] [user@
::1]
600 euah
=$
(echo $tuah |
tr -d "[]")
601 test_expect_success
"clone ssh://$tuah:22/home/user/repo" "
602 test_clone_url ssh://$tuah:22/home/user/repo '-p 22' $euah /home/user/repo
606 #IPv6 from home directory with port number
607 for tuah
in [::1] user@
[::1] [user@
::1]
609 euah
=$
(echo $tuah |
tr -d "[]")
610 test_expect_success
"clone ssh://$tuah:22/~repo" "
611 test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo'
615 test_expect_success
'clone from a repository with two identical branches' '
619 git checkout -b another main
621 git clone src target-11 &&
622 test "z$( cd target-11 && git symbolic-ref HEAD )" = zrefs/heads/another
626 test_expect_success
'shallow clone locally' '
627 git clone --depth=1 --no-local src ssrrcc &&
628 git clone ssrrcc ddsstt &&
629 test_cmp ssrrcc/.git/shallow ddsstt/.git/shallow &&
630 ( cd ddsstt && git fsck )
633 test_expect_success
'GIT_TRACE_PACKFILE produces a usable pack' '
635 GIT_TRACE_PACKFILE=$PWD/tmp.pack git clone --no-local --bare src dst.git &&
636 git init --bare replay.git &&
637 git -C replay.git index-pack -v --stdin <tmp.pack
640 test_expect_success
'clone on case-insensitive fs' '
644 o=$(git hash-object -w --stdin </dev/null | hex2oct) &&
645 t=$(printf "100644 X\0${o}100644 x\0${o}" |
646 git hash-object -w -t tree --stdin) &&
647 c=$(git commit-tree -m bogus $t) &&
648 git update-ref refs/heads/bogus $c &&
649 git clone -b bogus . bogus 2>warning
653 test_expect_success CASE_INSENSITIVE_FS
'colliding file detection' '
654 grep X icasefs/warning &&
655 grep x icasefs/warning &&
656 test_i18ngrep "the following paths have collided" icasefs/warning
659 test_expect_success
'clone with GIT_DEFAULT_HASH' '
661 sane_unset GIT_DEFAULT_HASH &&
662 git init --object-format=sha1 test-sha1 &&
663 git init --object-format=sha256 test-sha256
665 test_commit -C test-sha1 foo &&
666 test_commit -C test-sha256 foo &&
667 GIT_DEFAULT_HASH=sha1 git clone test-sha256 test-clone-sha256 &&
668 GIT_DEFAULT_HASH=sha256 git clone test-sha1 test-clone-sha1 &&
669 git -C test-clone-sha1 status &&
670 git -C test-clone-sha256 status
673 partial_clone_server
() {
676 rm -rf "$SERVER" client
&&
677 test_create_repo
"$SERVER" &&
678 test_commit
-C "$SERVER" one
&&
679 HASH1
=$
(git
-C "$SERVER" hash-object one.t
) &&
680 git
-C "$SERVER" revert HEAD
&&
681 test_commit
-C "$SERVER" two
&&
682 HASH2
=$
(git
-C "$SERVER" hash-object two.t
) &&
683 test_config
-C "$SERVER" uploadpack.allowfilter
1 &&
684 test_config
-C "$SERVER" uploadpack.allowanysha1inwant
1
691 partial_clone_server
"${SERVER}" &&
692 git clone
--filter=blob
:limit
=0 "$URL" client
&&
694 git
-C client fsck
&&
696 # Ensure that unneeded blobs are not inadvertently fetched.
697 test_config
-C client remote.origin.promisor
"false" &&
698 git
-C client config
--unset remote.origin.partialclonefilter
&&
699 test_must_fail git
-C client cat-file
-e "$HASH1" &&
701 # But this blob was fetched, because clone performs an initial checkout
702 git
-C client cat-file
-e "$HASH2"
705 test_expect_success
'partial clone' '
706 partial_clone server "file://$(pwd)/server"
709 test_expect_success
'partial clone with -o' '
710 partial_clone_server server &&
711 git clone -o blah --filter=blob:limit=0 "file://$(pwd)/server" client &&
712 test_cmp_config -C client "blob:limit=0" --get-all remote.blah.partialclonefilter
715 test_expect_success
'partial clone: warn if server does not support object filtering' '
716 rm -rf server client &&
717 test_create_repo server &&
718 test_commit -C server one &&
720 git clone --filter=blob:limit=0 "file://$(pwd)/server" client 2> err &&
722 test_i18ngrep "filtering not recognized by server" err
725 test_expect_success
'batch missing blob request during checkout' '
726 rm -rf server client &&
728 test_create_repo server &&
731 git -C server add a b &&
733 git -C server commit -m x &&
736 git -C server add a b &&
737 git -C server commit -m x &&
739 test_config -C server uploadpack.allowfilter 1 &&
740 test_config -C server uploadpack.allowanysha1inwant 1 &&
742 git clone --filter=blob:limit=0 "file://$(pwd)/server" client &&
744 # Ensure that there is only one negotiation by checking that there is
745 # only "done" line sent. ("done" marks the end of negotiation.)
746 GIT_TRACE_PACKET="$(pwd)/trace" \
747 GIT_TRACE2_EVENT="$(pwd)/trace2_event" \
748 git -C client -c trace2.eventNesting=5 checkout HEAD^ &&
749 grep \"key\":\"total_rounds\",\"value\":\"1\" trace2_event >trace_lines &&
750 test_line_count = 1 trace_lines &&
751 grep "fetch> done" trace >done_lines &&
752 test_line_count = 1 done_lines
755 test_expect_success
'batch missing blob request does not inadvertently try to fetch gitlinks' '
756 rm -rf server client &&
758 test_create_repo repo_for_submodule &&
759 test_commit -C repo_for_submodule x &&
761 test_create_repo server &&
764 git -C server add a b &&
765 git -C server commit -m x &&
769 # Also add a gitlink pointing to an arbitrary repository
770 git -C server submodule add "$(pwd)/repo_for_submodule" c &&
771 git -C server add a b c &&
772 git -C server commit -m x &&
774 test_config -C server uploadpack.allowfilter 1 &&
775 test_config -C server uploadpack.allowanysha1inwant 1 &&
777 # Make sure that it succeeds
778 git clone --filter=blob:limit=0 "file://$(pwd)/server" client
781 .
"$TEST_DIRECTORY"/lib-httpd.sh
784 test_expect_success
'partial clone using HTTP' '
785 partial_clone "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server"
788 test_expect_success
'reject cloning shallow repository using HTTP' '
789 test_when_finished "rm -rf repo" &&
790 git clone --bare --no-local --depth=1 src "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
791 test_must_fail git -c protocol.version=2 clone --reject-shallow $HTTPD_URL/smart/repo.git repo 2>err &&
792 test_i18ngrep -e "source repository is shallow, reject to clone." err &&
794 git clone --no-reject-shallow $HTTPD_URL/smart/repo.git repo
797 # DO NOT add non-httpd-specific tests here, because the last part of this
798 # test script is only executed when httpd is available and enabled.