Code

Merge branch 'tr/maint-bundle-boundary' into maint-1.7.8
[git.git] / t / t5601-clone.sh
index 214756731baf199e6a50f9ab2380a8b4bfc0fb18..87ee01662c2fcfa58d8f9896fd43881e2e7ed7d6 100755 (executable)
@@ -31,10 +31,10 @@ test_expect_success 'clone with excess parameters (2)' '
 
 '
 
-test_expect_success 'output from clone' '
+test_expect_success C_LOCALE_OUTPUT 'output from clone' '
        rm -fr dst &&
        git clone -n "file://$(pwd)/src" dst >output &&
-       test $(grep Initialized output | wc -l) = 1
+       test $(grep Clon output | wc -l) = 1
 '
 
 test_expect_success 'clone does not keep pack' '
@@ -163,10 +163,7 @@ test_expect_success 'clone a void' '
 
 test_expect_success 'clone respects global branch.autosetuprebase' '
        (
-               HOME=$(pwd) &&
-               export HOME &&
                test_config="$HOME/.gitconfig" &&
-               unset GIT_CONFIG_NOGLOBAL &&
                git config -f "$test_config" branch.autosetuprebase remote &&
                rm -fr dst &&
                git clone src dst &&
@@ -176,4 +173,79 @@ test_expect_success 'clone respects global branch.autosetuprebase' '
        )
 '
 
+test_expect_success 'respect url-encoding of file://' '
+       git init x+y &&
+       git clone "file://$PWD/x+y" xy-url-1 &&
+       git clone "file://$PWD/x%2By" xy-url-2
+'
+
+test_expect_success 'do not query-string-decode + in URLs' '
+       rm -rf x+y &&
+       git init "x y" &&
+       test_must_fail git clone "file://$PWD/x+y" xy-no-plus
+'
+
+test_expect_success 'do not respect url-encoding of non-url path' '
+       git init x+y &&
+       test_must_fail git clone x%2By xy-regular &&
+       git clone x+y xy-regular
+'
+
+test_expect_success 'clone separate gitdir' '
+       rm -rf dst &&
+       git clone --separate-git-dir realgitdir src dst &&
+       test -d realgitdir/refs
+'
+
+test_expect_success 'clone separate gitdir: output' '
+       echo "gitdir: `pwd`/realgitdir" >expected &&
+       test_cmp expected dst/.git
+'
+
+test_expect_success 'clone from .git file' '
+       git clone dst/.git dst2
+'
+
+test_expect_success 'fetch from .git gitfile' '
+       (
+               cd dst2 &&
+               git fetch ../dst/.git
+       )
+'
+
+test_expect_success 'fetch from gitfile parent' '
+       (
+               cd dst2 &&
+               git fetch ../dst
+       )
+'
+
+test_expect_success 'clone separate gitdir where target already exists' '
+       rm -rf dst &&
+       test_must_fail git clone --separate-git-dir realgitdir src dst
+'
+
+test_expect_success 'clone --reference from original' '
+       git clone --shared --bare src src-1 &&
+       git clone --bare src src-2 &&
+       git clone --reference=src-2 --bare src-1 target-8 &&
+       grep /src-2/ target-8/objects/info/alternates
+'
+
+test_expect_success 'clone with more than one --reference' '
+       git clone --bare src src-3 &&
+       git clone --bare src src-4 &&
+       git clone --reference=src-3 --reference=src-4 src target-9 &&
+       grep /src-3/ target-9/.git/objects/info/alternates &&
+       grep /src-4/ target-9/.git/objects/info/alternates
+'
+
+test_expect_success 'clone from original with relative alternate' '
+       mkdir nest &&
+       git clone --bare src nest/src-5 &&
+       echo ../../../src/.git/objects >nest/src-5/objects/info/alternates &&
+       git clone --bare nest/src-5 target-10 &&
+       grep /src/\\.git/objects target-10/objects/info/alternates
+'
+
 test_done