]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5601-clone.sh
Merge branch 'km/submodule-doc-use-sm-path' into maint
[thirdparty/git.git] / t / t5601-clone.sh
index ddaa96ac4f44a4e4799aa509b3bd69bc28628d60..ad8c41176ef76690004c8f73131a7ba464758143 100755 (executable)
@@ -345,7 +345,7 @@ expect_ssh () {
 }
 
 test_expect_success 'clone myhost:src uses ssh' '
-       git clone myhost:src ssh-clone &&
+       GIT_TEST_PROTOCOL_VERSION=0 git clone myhost:src ssh-clone &&
        expect_ssh myhost src
 '
 
@@ -356,12 +356,12 @@ test_expect_success !MINGW,!CYGWIN 'clone local path foo:bar' '
 '
 
 test_expect_success 'bracketed hostnames are still ssh' '
-       git clone "[myhost:123]:src" ssh-bracket-clone &&
+       GIT_TEST_PROTOCOL_VERSION=0 git clone "[myhost:123]:src" ssh-bracket-clone &&
        expect_ssh "-p 123" myhost src
 '
 
 test_expect_success 'OpenSSH variant passes -4' '
-       git clone -4 "[myhost:123]:src" ssh-ipv4-clone &&
+       GIT_TEST_PROTOCOL_VERSION=0 git clone -4 "[myhost:123]:src" ssh-ipv4-clone &&
        expect_ssh "-4 -p 123" myhost src
 '
 
@@ -405,7 +405,7 @@ test_expect_success 'OpenSSH-like uplink is treated as ssh' '
        test_when_finished "rm -f \"\$TRASH_DIRECTORY/uplink\"" &&
        GIT_SSH="$TRASH_DIRECTORY/uplink" &&
        test_when_finished "GIT_SSH=\"\$TRASH_DIRECTORY/ssh\$X\"" &&
-       git clone "[myhost:123]:src" ssh-bracket-clone-sshlike-uplink &&
+       GIT_TEST_PROTOCOL_VERSION=0 git clone "[myhost:123]:src" ssh-bracket-clone-sshlike-uplink &&
        expect_ssh "-p 123" myhost src
 '
 
@@ -434,7 +434,6 @@ test_expect_success 'double quoted plink.exe in GIT_SSH_COMMAND' '
        expect_ssh "-v -P 123" myhost src
 '
 
-SQ="'"
 test_expect_success 'single quoted plink.exe in GIT_SSH_COMMAND' '
        copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" &&
        GIT_SSH_COMMAND="$SQ$TRASH_DIRECTORY/plink.exe$SQ -v" \
@@ -444,14 +443,14 @@ test_expect_success 'single quoted plink.exe in GIT_SSH_COMMAND' '
 
 test_expect_success 'GIT_SSH_VARIANT overrides plink detection' '
        copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
-       GIT_SSH_VARIANT=ssh \
-       git clone "[myhost:123]:src" ssh-bracket-clone-variant-1 &&
+       GIT_TEST_PROTOCOL_VERSION=0 GIT_SSH_VARIANT=ssh \
+               git clone "[myhost:123]:src" ssh-bracket-clone-variant-1 &&
        expect_ssh "-p 123" myhost src
 '
 
 test_expect_success 'ssh.variant overrides plink detection' '
        copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
-       git -c ssh.variant=ssh \
+       GIT_TEST_PROTOCOL_VERSION=0 git -c ssh.variant=ssh \
                clone "[myhost:123]:src" ssh-bracket-clone-variant-2 &&
        expect_ssh "-p 123" myhost src
 '
@@ -482,12 +481,12 @@ counter=0
 # $3 path
 test_clone_url () {
        counter=$(($counter + 1))
-       test_might_fail git clone "$1" tmp$counter &&
+       test_might_fail env GIT_TEST_PROTOCOL_VERSION=0 git clone "$1" tmp$counter &&
        shift &&
        expect_ssh "$@"
 }
 
-test_expect_success !MINGW 'clone c:temp is ssl' '
+test_expect_success !MINGW,!CYGWIN 'clone c:temp is ssl' '
        test_clone_url c:temp c temp
 '
 
@@ -611,10 +610,6 @@ test_expect_success 'GIT_TRACE_PACKFILE produces a usable pack' '
        git -C replay.git index-pack -v --stdin <tmp.pack
 '
 
-hex2oct () {
-       perl -ne 'printf "\\%03o", hex for /../g'
-}
-
 test_expect_success 'clone on case-insensitive fs' '
        git init icasefs &&
        (
@@ -624,13 +619,18 @@ test_expect_success 'clone on case-insensitive fs' '
                        git hash-object -w -t tree --stdin) &&
                c=$(git commit-tree -m bogus $t) &&
                git update-ref refs/heads/bogus $c &&
-               git clone -b bogus . bogus
+               git clone -b bogus . bogus 2>warning
        )
 '
 
-partial_clone () {
+test_expect_success CASE_INSENSITIVE_FS 'colliding file detection' '
+       grep X icasefs/warning &&
+       grep x icasefs/warning &&
+       test_i18ngrep "the following paths have collided" icasefs/warning
+'
+
+partial_clone_server () {
               SERVER="$1" &&
-              URL="$2" &&
 
        rm -rf "$SERVER" client &&
        test_create_repo "$SERVER" &&
@@ -640,14 +640,21 @@ partial_clone () {
        test_commit -C "$SERVER" two &&
        HASH2=$(git hash-object "$SERVER/two.t") &&
        test_config -C "$SERVER" uploadpack.allowfilter 1 &&
-       test_config -C "$SERVER" uploadpack.allowanysha1inwant 1 &&
+       test_config -C "$SERVER" uploadpack.allowanysha1inwant 1
+}
 
+partial_clone () {
+              SERVER="$1" &&
+              URL="$2" &&
+
+       partial_clone_server "${SERVER}" &&
        git clone --filter=blob:limit=0 "$URL" client &&
 
        git -C client fsck &&
 
        # Ensure that unneeded blobs are not inadvertently fetched.
-       test_config -C client extensions.partialclone "not a remote" &&
+       test_config -C client remote.origin.promisor "false" &&
+       git -C client config --unset remote.origin.partialclonefilter &&
        test_must_fail git -C client cat-file -e "$HASH1" &&
 
        # But this blob was fetched, because clone performs an initial checkout
@@ -658,6 +665,11 @@ test_expect_success 'partial clone' '
        partial_clone server "file://$(pwd)/server"
 '
 
+test_expect_success 'partial clone with -o' '
+       partial_clone_server server &&
+       git clone -o blah --filter=blob:limit=0 "file://$(pwd)/server" client
+'
+
 test_expect_success 'partial clone: warn if server does not support object filtering' '
        rm -rf server client &&
        test_create_repo server &&
@@ -727,6 +739,7 @@ test_expect_success 'partial clone using HTTP' '
        partial_clone "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server"
 '
 
-stop_httpd
+# DO NOT add non-httpd-specific tests here, because the last part of this
+# test script is only executed when httpd is available and enabled.
 
 test_done