mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
tests: always test fetch of unreachable with v0
Some tests check that fetching an unreachable object fails, but protocol v2 allows such fetches. Unset GIT_TEST_PROTOCOL_VERSION so that these tests are always run using protocol v0. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3a5728dcca
commit
ab0c5f5096
|
@ -636,7 +636,9 @@ test_expect_success 'fetch-pack cannot fetch a raw sha1 that is not advertised a
|
|||
test_commit -C server 6 &&
|
||||
|
||||
git init client &&
|
||||
test_must_fail git -C client fetch-pack ../server \
|
||||
# Some protocol versions (e.g. 2) support fetching
|
||||
# unadvertised objects, so restrict this test to v0.
|
||||
test_must_fail env GIT_TEST_PROTOCOL_VERSION= git -C client fetch-pack ../server \
|
||||
$(git -C server rev-parse refs/heads/master^) 2>err &&
|
||||
test_i18ngrep "Server does not allow request for unadvertised object" err
|
||||
'
|
||||
|
|
|
@ -1147,8 +1147,12 @@ test_expect_success 'fetch exact SHA1' '
|
|||
git prune &&
|
||||
test_must_fail git cat-file -t $the_commit &&
|
||||
|
||||
# Some protocol versions (e.g. 2) support fetching
|
||||
# unadvertised objects, so restrict this test to v0.
|
||||
|
||||
# fetching the hidden object should fail by default
|
||||
test_must_fail git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err &&
|
||||
test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
|
||||
git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err &&
|
||||
test_i18ngrep "Server does not allow request for unadvertised object" err &&
|
||||
test_must_fail git rev-parse --verify refs/heads/copy &&
|
||||
|
||||
|
@ -1204,7 +1208,10 @@ do
|
|||
mk_empty shallow &&
|
||||
(
|
||||
cd shallow &&
|
||||
test_must_fail git fetch --depth=1 ../testrepo/.git $SHA1 &&
|
||||
# Some protocol versions (e.g. 2) support fetching
|
||||
# unadvertised objects, so restrict this test to v0.
|
||||
test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
|
||||
git fetch --depth=1 ../testrepo/.git $SHA1 &&
|
||||
git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
|
||||
git fetch --depth=1 ../testrepo/.git $SHA1 &&
|
||||
git cat-file commit $SHA1
|
||||
|
@ -1232,15 +1239,20 @@ do
|
|||
mk_empty shallow &&
|
||||
(
|
||||
cd shallow &&
|
||||
test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_3 &&
|
||||
test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_1 &&
|
||||
# Some protocol versions (e.g. 2) support fetching
|
||||
# unadvertised objects, so restrict this test to v0.
|
||||
test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \
|
||||
git fetch ../testrepo/.git $SHA1_3 &&
|
||||
test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \
|
||||
git fetch ../testrepo/.git $SHA1_1 &&
|
||||
git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
|
||||
git fetch ../testrepo/.git $SHA1_1 &&
|
||||
git cat-file commit $SHA1_1 &&
|
||||
test_must_fail git cat-file commit $SHA1_2 &&
|
||||
git fetch ../testrepo/.git $SHA1_2 &&
|
||||
git cat-file commit $SHA1_2 &&
|
||||
test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_3
|
||||
test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \
|
||||
git fetch ../testrepo/.git $SHA1_3
|
||||
)
|
||||
'
|
||||
done
|
||||
|
|
|
@ -307,7 +307,10 @@ test_expect_success 'test allowreachablesha1inwant with unreachable' '
|
|||
|
||||
git init --bare test_reachable.git &&
|
||||
git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" &&
|
||||
test_must_fail git -C test_reachable.git fetch origin "$(git rev-parse HEAD)"
|
||||
# Some protocol versions (e.g. 2) support fetching
|
||||
# unadvertised objects, so restrict this test to v0.
|
||||
test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
|
||||
git -C test_reachable.git fetch origin "$(git rev-parse HEAD)"
|
||||
'
|
||||
|
||||
test_expect_success 'test allowanysha1inwant with unreachable' '
|
||||
|
@ -326,7 +329,10 @@ test_expect_success 'test allowanysha1inwant with unreachable' '
|
|||
|
||||
git init --bare test_reachable.git &&
|
||||
git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" &&
|
||||
test_must_fail git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" &&
|
||||
# Some protocol versions (e.g. 2) support fetching
|
||||
# unadvertised objects, so restrict this test to v0.
|
||||
test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
|
||||
git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" &&
|
||||
|
||||
git -C "$server" config uploadpack.allowanysha1inwant 1 &&
|
||||
git -C test_reachable.git fetch origin "$(git rev-parse HEAD)"
|
||||
|
|
|
@ -943,7 +943,10 @@ test_expect_success 'submodule update clone shallow submodule outside of depth'
|
|||
cd super3 &&
|
||||
sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
|
||||
mv -f .gitmodules.tmp .gitmodules &&
|
||||
test_must_fail git submodule update --init --depth=1 2>actual &&
|
||||
# Some protocol versions (e.g. 2) support fetching
|
||||
# unadvertised objects, so restrict this test to v0.
|
||||
test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
|
||||
git submodule update --init --depth=1 2>actual &&
|
||||
test_i18ngrep "Direct fetching of that commit failed." actual &&
|
||||
git -C ../submodule config uploadpack.allowReachableSHA1InWant true &&
|
||||
git submodule update --init --depth=1 >actual &&
|
||||
|
|
Loading…
Reference in a new issue