diff options
Diffstat (limited to 't/t5516-fetch-push.sh')
-rwxr-xr-x | t/t5516-fetch-push.sh | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index f3356f9..2e7c0e1 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -120,6 +120,17 @@ test_expect_success setup ' ' +for cmd in push fetch +do + for opt in ipv4 ipv6 + do + test_expect_success "reject 'git $cmd --no-$opt'" ' + test_must_fail git $cmd --no-$opt 2>err && + grep "unknown option .no-$opt" err + ' + done +done + test_expect_success 'fetch without wildcard' ' mk_empty testrepo && ( @@ -200,7 +211,10 @@ test_expect_success 'push with negotiation' ' test_commit -C testrepo unrelated_commit && git -C testrepo config receive.hideRefs refs/remotes/origin/first_commit && test_when_finished "rm event" && - GIT_TRACE2_EVENT="$(pwd)/event" git -c protocol.version=2 -c push.negotiate=1 push testrepo refs/heads/main:refs/remotes/origin/main && + GIT_TRACE2_EVENT="$(pwd)/event" \ + git -c protocol.version=2 -c push.negotiate=1 \ + push testrepo refs/heads/main:refs/remotes/origin/main && + grep \"key\":\"total_rounds\",\"value\":\"1\" event && grep_wrote 2 event # 1 commit, 1 tree ' @@ -213,18 +227,22 @@ test_expect_success 'push with negotiation proceeds anyway even if negotiation f GIT_TEST_PROTOCOL_VERSION=0 GIT_TRACE2_EVENT="$(pwd)/event" \ git -c push.negotiate=1 push testrepo refs/heads/main:refs/remotes/origin/main 2>err && grep_wrote 5 event && # 2 commits, 2 trees, 1 blob - test_i18ngrep "push negotiation failed" err + test_grep "push negotiation failed" err ' test_expect_success 'push with negotiation does not attempt to fetch submodules' ' mk_empty submodule_upstream && test_commit -C submodule_upstream submodule_commit && + test_config_global protocol.file.allow always && git submodule add ./submodule_upstream submodule && mk_empty testrepo && git push testrepo $the_first_commit:refs/remotes/origin/first_commit && test_commit -C testrepo unrelated_commit && git -C testrepo config receive.hideRefs refs/remotes/origin/first_commit && - git -c submodule.recurse=true -c protocol.version=2 -c push.negotiate=1 push testrepo refs/heads/main:refs/remotes/origin/main 2>err && + GIT_TRACE2_EVENT="$(pwd)/event" git -c submodule.recurse=true \ + -c protocol.version=2 -c push.negotiate=1 \ + push testrepo refs/heads/main:refs/remotes/origin/main 2>err && + grep \"key\":\"total_rounds\",\"value\":\"1\" event && ! grep "Fetching submodule" err ' @@ -394,6 +412,11 @@ test_expect_success 'push with ambiguity' ' ' +test_expect_success 'push with onelevel ref' ' + mk_test testrepo heads/main && + test_must_fail git push testrepo HEAD:refs/onelevel +' + test_expect_success 'push with colon-less refspec (1)' ' mk_test testrepo heads/frotz tags/frotz && @@ -891,6 +914,13 @@ test_expect_success 'push --delete refuses empty string' ' test_must_fail git push testrepo --delete "" ' +test_expect_success 'push --delete onelevel refspecs' ' + mk_test testrepo heads/main && + git -C testrepo update-ref refs/onelevel refs/heads/main && + git push testrepo --delete refs/onelevel && + test_must_fail git -C testrepo rev-parse --verify refs/onelevel +' + test_expect_success 'warn on push to HEAD of non-bare repository' ' mk_test testrepo heads/main && ( @@ -1237,7 +1267,7 @@ test_expect_success 'fetch exact SHA1' ' # fetching the hidden object should fail by default test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err && - test_i18ngrep "Server does not allow request for unadvertised object" err && + test_grep "Server does not allow request for unadvertised object" err && test_must_fail git rev-parse --verify refs/heads/copy && # the server side can allow it to succeed @@ -1339,7 +1369,7 @@ do git fetch ../testrepo/.git $SHA1_3 2>err && # ideally we would insist this be on a "remote error:" # line, but it is racy; see the commit message - test_i18ngrep "not our ref.*$SHA1_3\$" err + test_grep "not our ref.*$SHA1_3\$" err ) ' done @@ -1377,7 +1407,7 @@ test_expect_success 'peeled advertisements are not considered ref tips' ' oid=$(git -C testrepo rev-parse mytag^{commit}) && test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 \ git fetch testrepo $oid 2>err && - test_i18ngrep "Server does not allow request for unadvertised object" err + test_grep "Server does not allow request for unadvertised object" err ' test_expect_success 'pushing a specific ref applies remote.$name.push as refmap' ' @@ -1846,55 +1876,24 @@ test_expect_success 'refuse to push a hidden ref, and make sure do not pollute t test_dir_is_empty testrepo/.git/objects/pack ' -test_expect_success LIBCURL 'fetch warns or fails when using username:password' ' - message="URL '\''https://username:<redacted>@localhost/'\'' uses plaintext credentials" && - test_must_fail git -c transfer.credentialsInUrl=allow fetch https://username:password@localhost 2>err && - ! grep "$message" err && - - test_must_fail git -c transfer.credentialsInUrl=warn fetch https://username:password@localhost 2>err && - grep "warning: $message" err >warnings && - test_line_count = 3 warnings && - - test_must_fail git -c transfer.credentialsInUrl=die fetch https://username:password@localhost 2>err && - grep "fatal: $message" err >warnings && - test_line_count = 1 warnings && - - test_must_fail git -c transfer.credentialsInUrl=die fetch https://username:@localhost 2>err && - grep "fatal: $message" err >warnings && - test_line_count = 1 warnings -' - - -test_expect_success LIBCURL 'push warns or fails when using username:password' ' - message="URL '\''https://username:<redacted>@localhost/'\'' uses plaintext credentials" && - test_must_fail git -c transfer.credentialsInUrl=allow push https://username:password@localhost 2>err && - ! grep "$message" err && - - test_must_fail git -c transfer.credentialsInUrl=warn push https://username:password@localhost 2>err && - grep "warning: $message" err >warnings && - test_must_fail git -c transfer.credentialsInUrl=die push https://username:password@localhost 2>err && - grep "fatal: $message" err >warnings && - test_line_count = 1 warnings -' - test_expect_success 'push with config push.useBitmaps' ' mk_test testrepo heads/main && git checkout main && test_unconfig push.useBitmaps && GIT_TRACE2_EVENT="$PWD/default" \ - git push testrepo main:test && + git push --quiet testrepo main:test && test_subcommand git pack-objects --all-progress-implied --revs --stdout \ --thin --delta-base-offset -q <default && test_config push.useBitmaps true && GIT_TRACE2_EVENT="$PWD/true" \ - git push testrepo main:test2 && + git push --quiet testrepo main:test2 && test_subcommand git pack-objects --all-progress-implied --revs --stdout \ --thin --delta-base-offset -q <true && test_config push.useBitmaps false && GIT_TRACE2_EVENT="$PWD/false" \ - git push testrepo main:test3 && + git push --quiet testrepo main:test3 && test_subcommand git pack-objects --all-progress-implied --revs --stdout \ --thin --delta-base-offset -q --no-use-bitmap-index <false ' |