]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5500-fetch-pack.sh
Merge branch 'jt/v2-fetch-nego-fix'
[thirdparty/git.git] / t / t5500-fetch-pack.sh
index fd39aad93ff989e16a531bfcb6719a9d6bc73032..52dd1a688cd052a098586b6e1a89b2f621fdd99c 100755 (executable)
@@ -488,11 +488,12 @@ test_expect_success 'setup tests for the --stdin parameter' '
 '
 
 test_expect_success 'setup fetch refs from cmdline v[12]' '
+       cp -r client client0 &&
        cp -r client client1 &&
        cp -r client client2
 '
 
-for version in '' 1 2
+for version in '' 1 2
 do
        test_expect_success "protocol.version=$version fetch refs from cmdline" "
                (
@@ -686,7 +687,7 @@ test_expect_success 'fetch-pack cannot fetch a raw sha1 that is not advertised a
        git init client &&
        # 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 \
+       test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 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
 '
@@ -965,7 +966,10 @@ test_expect_success 'filtering by size' '
        git -C client fetch-pack --filter=blob:limit=0 ../server HEAD &&
 
        # Ensure that object is not inadvertently fetched
-       test_must_fail git -C client cat-file -e $(git hash-object server/one.t)
+       commit=$(git -C server rev-parse HEAD) &&
+       blob=$(git hash-object server/one.t) &&
+       git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
+       ! grep "$blob" oids
 '
 
 test_expect_success 'filtering by size has no effect if support for it is not advertised' '
@@ -977,7 +981,10 @@ test_expect_success 'filtering by size has no effect if support for it is not ad
        git -C client fetch-pack --filter=blob:limit=0 ../server HEAD 2> err &&
 
        # Ensure that object is fetched
-       git -C client cat-file -e $(git hash-object server/one.t) &&
+       commit=$(git -C server rev-parse HEAD) &&
+       blob=$(git hash-object server/one.t) &&
+       git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
+       grep "$blob" oids &&
 
        test_i18ngrep "filtering not recognized by server" err
 '
@@ -999,9 +1006,11 @@ fetch_filter_blob_limit_zero () {
        git -C client fetch --filter=blob:limit=0 origin HEAD:somewhere &&
 
        # Ensure that commit is fetched, but blob is not
-       test_config -C client extensions.partialclone "arbitrary string" &&
-       git -C client cat-file -e $(git -C "$SERVER" rev-parse two) &&
-       test_must_fail git -C client cat-file -e $(git hash-object "$SERVER/two.t")
+       commit=$(git -C "$SERVER" rev-parse two) &&
+       blob=$(git hash-object server/two.t) &&
+       git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
+       grep "$commit" oids &&
+       ! grep "$blob" oids
 }
 
 test_expect_success 'fetch with --filter=blob:limit=0' '