transport: die if server options are unsupported
[gitweb.git] / t / t5322-pack-objects-sparse.sh
index 9f2a6e5d31e3a53877851e8893da3d1e3e1cf6d2..7124b5581a0e3e31ae9b78b46aec9f059eeb7c1a 100755 (executable)
@@ -36,7 +36,7 @@ test_expect_success 'setup repo' '
 '
 
 test_expect_success 'non-sparse pack-objects' '
-       git pack-objects --stdout --revs <packinput.txt >nonsparse.pack &&
+       git pack-objects --stdout --revs --no-sparse <packinput.txt >nonsparse.pack &&
        git index-pack -o nonsparse.idx nonsparse.pack &&
        git show-index <nonsparse.idx | awk "{print \$2}" >nonsparse_objects.txt &&
        test_cmp expect_objects.txt nonsparse_objects.txt
@@ -64,7 +64,7 @@ test_expect_success 'duplicate a folder from f3 and commit to topic1' '
 '
 
 test_expect_success 'non-sparse pack-objects' '
-       git pack-objects --stdout --revs <packinput.txt >nonsparse.pack &&
+       git pack-objects --stdout --revs --no-sparse <packinput.txt >nonsparse.pack &&
        git index-pack -o nonsparse.idx nonsparse.pack &&
        git show-index <nonsparse.idx | awk "{print \$2}" >nonsparse_objects.txt &&
        comm -1 -2 required_objects.txt nonsparse_objects.txt >nonsparse_required_objects.txt &&
@@ -118,4 +118,19 @@ test_expect_success 'sparse pack-objects' '
        test_cmp expect_sparse_objects.txt sparse_objects.txt
 '
 
+test_expect_success 'pack.useSparse enables algorithm' '
+       git config pack.useSparse true &&
+       git pack-objects --stdout --revs <packinput.txt >sparse.pack &&
+       git index-pack -o sparse.idx sparse.pack &&
+       git show-index <sparse.idx | awk "{print \$2}" >sparse_objects.txt &&
+       test_cmp expect_sparse_objects.txt sparse_objects.txt
+'
+
+test_expect_success 'pack.useSparse overridden' '
+       git pack-objects --stdout --revs --no-sparse <packinput.txt >sparse.pack &&
+       git index-pack -o sparse.idx sparse.pack &&
+       git show-index <sparse.idx | awk "{print \$2}" >sparse_objects.txt &&
+       test_cmp required_objects.txt sparse_objects.txt
+'
+
 test_done