path: root/t
diff options
authorDerrick Stolee <>2020-03-20 12:38:09 (GMT)
committerJunio C Hamano <>2020-03-20 21:22:31 (GMT)
commitde3a864114291632c05e67bec4a316257c7ff97d (patch)
treea67f00f13d80cffd692e1fc675b57c3745b7a286 /t
parent98cedd0233ee88e69711f79d1126b6bd772ff5bd (diff)
config: set pack.useSparse=true by default
The pack.useSparse config option was introduced by 3d036eb0 (pack-objects: create pack.useSparse setting, 2019-01-19) and was first available in v2.21.0. When enabled, the pack-objects process during 'git push' will use a sparse tree walk when deciding which trees and blobs to send to the remote. The algorithm was introduced by d5d2e93 (revision: implement sparse algorithm, 2019-01-16) and has been in production use by VFS for Git since around that time. The features.experimental config option also enabled pack.useSparse, so hopefully that has also increased exposure. It is worth noting that pack.useSparse has a possibility of sending more objects across a push, but requires a special arrangement of exact _copies_ across directories. There is a test in that demonstrates this possibility. This test uses the --sparse option to "git pack-objects" but we can make it implied by the config value to demonstrate that the default value has changed. While updating that test, I noticed that the documentation did not include an option for --no-sparse, which is now more important than it was before. Since the downside is unlikely but the upside is significant, set the default value of pack.useSparse to true. Remove it from the set of options implied by features.experimental. Signed-off-by: Derrick Stolee <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't')
1 files changed, 2 insertions, 1 deletions
diff --git a/t/ b/t/
index 7124b55..6e5d6bd 100755
--- a/t/
+++ b/t/
@@ -105,6 +105,7 @@ test_expect_success 'non-sparse pack-objects' '
test_cmp required_objects.txt nonsparse_required_objects.txt
+# --sparse is enabled by default by pack.useSparse
test_expect_success 'sparse pack-objects' '
git rev-parse \
topic1 \
@@ -112,7 +113,7 @@ test_expect_success 'sparse pack-objects' '
topic1:f3 \
topic1:f3/f4 \
topic1:f3/f4/data.txt | sort >expect_sparse_objects.txt &&
- git pack-objects --stdout --revs --sparse <packinput.txt >sparse.pack &&
+ 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