summaryrefslogtreecommitdiff
path: root/t/t5322-pack-objects-sparse.sh
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2019-01-16 18:26:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-17 21:44:43 (GMT)
commit3d036eb0d2c778941cd31b8785d5036949e8778b (patch)
treecb67ddde97b94b11b041a12ca63d2bcf652c16e9 /t/t5322-pack-objects-sparse.sh
parentd5d2e93577e2b9f4a251f97116259346f0bead1e (diff)
downloadgit-3d036eb0d2c778941cd31b8785d5036949e8778b.zip
git-3d036eb0d2c778941cd31b8785d5036949e8778b.tar.gz
git-3d036eb0d2c778941cd31b8785d5036949e8778b.tar.bz2
pack-objects: create pack.useSparse setting
The '--sparse' flag in 'git pack-objects' changes the algorithm used to enumerate objects to one that is faster for individual users pushing new objects that change only a small cone of the working directory. The sparse algorithm is not recommended for a server, which likely sends new objects that appear across the entire working directory. Create a 'pack.useSparse' setting that enables this new algorithm. This allows 'git push' to use this algorithm without passing a '--sparse' flag all the way through four levels of run_command() calls. If the '--no-sparse' flag is set, then this config setting is overridden. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5322-pack-objects-sparse.sh')
-rwxr-xr-xt/t5322-pack-objects-sparse.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t5322-pack-objects-sparse.sh b/t/t5322-pack-objects-sparse.sh
index 9f2a6e5..3233faf 100755
--- a/t/t5322-pack-objects-sparse.sh
+++ b/t/t5322-pack-objects-sparse.sh
@@ -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