diff options
Diffstat (limited to 't/t5601-clone.sh')
-rwxr-xr-x | t/t5601-clone.sh | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 7df3c5373a..83c24fc97a 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -2,6 +2,9 @@ test_description=clone +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh X= @@ -37,7 +40,7 @@ test_expect_success 'clone with excess parameters (2)' ' ' -test_expect_success C_LOCALE_OUTPUT 'output from clone' ' +test_expect_success 'output from clone' ' rm -fr dst && git clone -n "file://$(pwd)/src" dst >output 2>&1 && test $(grep Clon output | wc -l) = 1 @@ -217,7 +220,7 @@ test_expect_success 'clone respects global branch.autosetuprebase' ' rm -fr dst && git clone src dst && cd dst && - actual="z$(git config branch.master.rebase)" && + actual="z$(git config branch.main.rebase)" && test ztrue = $actual ) ' @@ -302,7 +305,8 @@ test_expect_success 'clone from original with relative alternate' ' test_expect_success 'clone checking out a tag' ' git clone --branch=some-tag src dst.tag && GIT_DIR=src/.git git rev-parse some-tag >expected && - test_cmp expected dst.tag/.git/HEAD && + GIT_DIR=dst.tag/.git git rev-parse HEAD >actual && + test_cmp expected actual && GIT_DIR=dst.tag/.git git config remote.origin.fetch >fetch.actual && echo "+refs/heads/*:refs/remotes/origin/*" >fetch.expected && test_cmp fetch.expected fetch.actual @@ -591,7 +595,7 @@ test_expect_success 'clone from a repository with two identical branches' ' ( cd src && - git checkout -b another master + git checkout -b another main ) && git clone src target-11 && test "z$( cd target-11 && git symbolic-ref HEAD )" = zrefs/heads/another @@ -756,6 +760,15 @@ test_expect_success 'partial clone using HTTP' ' partial_clone "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server" ' +test_expect_success 'reject cloning shallow repository using HTTP' ' + test_when_finished "rm -rf repo" && + git clone --bare --no-local --depth=1 src "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && + test_must_fail git -c protocol.version=2 clone --reject-shallow $HTTPD_URL/smart/repo.git repo 2>err && + test_i18ngrep -e "source repository is shallow, reject to clone." err && + + git clone --no-reject-shallow $HTTPD_URL/smart/repo.git repo +' + # 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. |