diff options
Diffstat (limited to 'third_party/git/t/t5510-fetch.sh')
-rwxr-xr-x | third_party/git/t/t5510-fetch.sh | 110 |
1 files changed, 27 insertions, 83 deletions
diff --git a/third_party/git/t/t5510-fetch.sh b/third_party/git/t/t5510-fetch.sh index a66dbe0bde0d..139f7106f781 100755 --- a/third_party/git/t/t5510-fetch.sh +++ b/third_party/git/t/t5510-fetch.sh @@ -11,7 +11,7 @@ D=$(pwd) test_bundle_object_count () { git verify-pack -v "$1" >verify.out && - test "$2" = $(grep "^$OID_REGEX " verify.out | wc -l) + test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l) } convert_bundle_to_pack () { @@ -174,30 +174,6 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec' git rev-parse sometag ' -test_expect_success '--refmap="" ignores configured refspec' ' - cd "$TRASH_DIRECTORY" && - git clone "$D" remote-refs && - git -C remote-refs rev-parse remotes/origin/master >old && - git -C remote-refs update-ref refs/remotes/origin/master master~1 && - git -C remote-refs rev-parse remotes/origin/master >new && - git -C remote-refs fetch --refmap= origin "+refs/heads/*:refs/hidden/origin/*" && - git -C remote-refs rev-parse remotes/origin/master >actual && - test_cmp new actual && - git -C remote-refs fetch origin && - git -C remote-refs rev-parse remotes/origin/master >actual && - test_cmp old actual -' - -test_expect_success '--refmap="" and --prune' ' - git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch master && - git -C remote-refs update-ref refs/hidden/foo/otherbranch master && - git -C remote-refs fetch --prune --refmap="" origin +refs/heads/*:refs/hidden/* && - git -C remote-refs rev-parse remotes/origin/foo/otherbranch && - test_must_fail git -C remote-refs rev-parse refs/hidden/foo/otherbranch && - git -C remote-refs fetch --prune origin && - test_must_fail git -C remote-refs rev-parse remotes/origin/foo/otherbranch -' - test_expect_success 'fetch tags when there is no tags' ' cd "$D" && @@ -285,10 +261,9 @@ test_expect_success 'create bundle 1' ' ' test_expect_success 'header of bundle looks right' ' - head -n 4 "$D"/bundle1 && head -n 1 "$D"/bundle1 | grep "^#" && - head -n 2 "$D"/bundle1 | grep "^-$OID_REGEX " && - head -n 3 "$D"/bundle1 | grep "^$OID_REGEX " && + head -n 2 "$D"/bundle1 | grep "^-[0-9a-f]\{40\} " && + head -n 3 "$D"/bundle1 | grep "^[0-9a-f]\{40\} " && head -n 4 "$D"/bundle1 | grep "^$" ' @@ -314,7 +289,7 @@ test_expect_success 'bundle 1 has only 3 files ' ' test_expect_success 'unbundle 2' ' cd "$D/bundle" && git fetch ../bundle2 master:master && - test "tip" = "$(git log -1 --pretty=oneline master | cut -d" " -f2)" + test "tip" = "$(git log -1 --pretty=oneline master | cut -b42-)" ' test_expect_success 'bundle does not prerequisite objects' ' @@ -379,6 +354,7 @@ test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge # the strange name is: a\!'b test_expect_success 'quoting of a strangely named repo' ' test_must_fail git fetch "a\\!'\''b" > result 2>&1 && + cat result && grep "fatal: '\''a\\\\!'\''b'\''" result ' @@ -594,35 +570,6 @@ test_expect_success 'LHS of refspec follows ref disambiguation rules' ' ) ' -test_expect_success 'fetch.writeCommitGraph' ' - git clone three write && - ( - cd three && - test_commit new - ) && - ( - cd write && - git -c fetch.writeCommitGraph fetch origin && - test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain - ) -' - -test_expect_success 'fetch.writeCommitGraph with submodules' ' - git clone dups super && - ( - cd super && - git submodule add "file://$TRASH_DIRECTORY/three" && - git commit -m "add submodule" - ) && - git clone "super" super-clone && - ( - cd super-clone && - rm -rf .git/objects/info && - git -c fetch.writeCommitGraph=true fetch origin && - test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain - ) -' - # configured prune tests set_config_tristate () { @@ -955,29 +902,6 @@ test_expect_success C_LOCALE_OUTPUT 'fetch compact output' ' test_cmp expect actual ' -test_expect_success '--no-show-forced-updates' ' - mkdir forced-updates && - ( - cd forced-updates && - git init && - test_commit 1 && - test_commit 2 - ) && - git clone forced-updates forced-update-clone && - git clone forced-updates no-forced-update-clone && - git -C forced-updates reset --hard HEAD~1 && - ( - cd forced-update-clone && - git fetch --show-forced-updates origin 2>output && - test_i18ngrep "(forced update)" output - ) && - ( - cd no-forced-update-clone && - git fetch --no-show-forced-updates origin 2>output && - test_i18ngrep ! "(forced update)" output - ) -' - setup_negotiation_tip () { SERVER="$1" URL="$2" @@ -1054,7 +978,27 @@ test_expect_success '--negotiation-tip limits "have" lines sent with HTTP protoc check_negotiation_tip ' -# 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_expect_success '--no-show-forced-updates' ' + mkdir forced-updates && + ( + cd forced-updates && + git init && + test_commit 1 && + test_commit 2 + ) && + git clone forced-updates forced-update-clone && + git clone forced-updates no-forced-update-clone && + git -C forced-updates reset --hard HEAD~1 && + ( + cd forced-update-clone && + git fetch --show-forced-updates origin 2>output && + test_i18ngrep "(forced update)" output + ) && + ( + cd no-forced-update-clone && + git fetch --no-show-forced-updates origin 2>output && + ! test_i18ngrep "(forced update)" output + ) +' test_done |