mirror of https://github.com/git/git.git
Merge branch 'ds/default-pack-use-sparse-to-true'
The 'pack.useSparse' configuration variable now defaults to 'true', enabling an optimization that has been experimental since Git 2.21. * ds/default-pack-use-sparse-to-true: pack-objects: flip the use of GIT_TEST_PACK_SPARSE config: set pack.useSparse=true by default
This commit is contained in:
commit
9fadedd637
|
@ -12,9 +12,6 @@ feature.experimental::
|
||||||
setting if you are interested in providing feedback on experimental
|
setting if you are interested in providing feedback on experimental
|
||||||
features. The new default values are:
|
features. The new default values are:
|
||||||
+
|
+
|
||||||
* `pack.useSparse=true` uses a new algorithm when constructing a pack-file
|
|
||||||
which can improve `git push` performance in repos with many files.
|
|
||||||
+
|
|
||||||
* `fetch.negotiationAlgorithm=skipping` may improve fetch negotiation times by
|
* `fetch.negotiationAlgorithm=skipping` may improve fetch negotiation times by
|
||||||
skipping more commits at a time, reducing the number of round trips.
|
skipping more commits at a time, reducing the number of round trips.
|
||||||
+
|
+
|
||||||
|
|
|
@ -119,8 +119,8 @@ pack.useSparse::
|
||||||
objects. This can have significant performance benefits when
|
objects. This can have significant performance benefits when
|
||||||
computing a pack to send a small change. However, it is possible
|
computing a pack to send a small change. However, it is possible
|
||||||
that extra objects are added to the pack-file if the included
|
that extra objects are added to the pack-file if the included
|
||||||
commits contain certain types of direct renames. Default is `false`
|
commits contain certain types of direct renames. Default is
|
||||||
unless `feature.experimental` is enabled.
|
`true`.
|
||||||
|
|
||||||
pack.writeBitmaps (deprecated)::
|
pack.writeBitmaps (deprecated)::
|
||||||
This is a deprecated synonym for `repack.writeBitmaps`.
|
This is a deprecated synonym for `repack.writeBitmaps`.
|
||||||
|
|
|
@ -14,7 +14,7 @@ SYNOPSIS
|
||||||
[--local] [--incremental] [--window=<n>] [--depth=<n>]
|
[--local] [--incremental] [--window=<n>] [--depth=<n>]
|
||||||
[--revs [--unpacked | --all]] [--keep-pack=<pack-name>]
|
[--revs [--unpacked | --all]] [--keep-pack=<pack-name>]
|
||||||
[--stdout [--filter=<filter-spec>] | base-name]
|
[--stdout [--filter=<filter-spec>] | base-name]
|
||||||
[--shallow] [--keep-true-parents] [--sparse] < object-list
|
[--shallow] [--keep-true-parents] [--[no-]sparse] < object-list
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
@ -196,14 +196,16 @@ depth is 4095.
|
||||||
Add --no-reuse-object if you want to force a uniform compression
|
Add --no-reuse-object if you want to force a uniform compression
|
||||||
level on all data no matter the source.
|
level on all data no matter the source.
|
||||||
|
|
||||||
--sparse::
|
--[no-]sparse::
|
||||||
Use the "sparse" algorithm to determine which objects to include in
|
Toggle the "sparse" algorithm to determine which objects to include in
|
||||||
the pack, when combined with the "--revs" option. This algorithm
|
the pack, when combined with the "--revs" option. This algorithm
|
||||||
only walks trees that appear in paths that introduce new objects.
|
only walks trees that appear in paths that introduce new objects.
|
||||||
This can have significant performance benefits when computing
|
This can have significant performance benefits when computing
|
||||||
a pack to send a small change. However, it is possible that extra
|
a pack to send a small change. However, it is possible that extra
|
||||||
objects are added to the pack-file if the included commits contain
|
objects are added to the pack-file if the included commits contain
|
||||||
certain types of direct renames.
|
certain types of direct renames. If this option is not included,
|
||||||
|
it defaults to the value of `pack.useSparse`, which is true unless
|
||||||
|
otherwise specified.
|
||||||
|
|
||||||
--thin::
|
--thin::
|
||||||
Create a "thin" pack by omitting the common objects between a
|
Create a "thin" pack by omitting the common objects between a
|
||||||
|
|
|
@ -3469,9 +3469,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
read_replace_refs = 0;
|
read_replace_refs = 0;
|
||||||
|
|
||||||
sparse = git_env_bool("GIT_TEST_PACK_SPARSE", 0);
|
sparse = git_env_bool("GIT_TEST_PACK_SPARSE", -1);
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
if (!sparse && the_repository->settings.pack_use_sparse != -1)
|
if (sparse < 0)
|
||||||
sparse = the_repository->settings.pack_use_sparse;
|
sparse = the_repository->settings.pack_use_sparse;
|
||||||
|
|
||||||
reset_pack_idx_option(&pack_idx_opts);
|
reset_pack_idx_option(&pack_idx_opts);
|
||||||
|
|
|
@ -45,6 +45,8 @@ void prepare_repo_settings(struct repository *r)
|
||||||
|
|
||||||
if (!repo_config_get_bool(r, "pack.usesparse", &value))
|
if (!repo_config_get_bool(r, "pack.usesparse", &value))
|
||||||
r->settings.pack_use_sparse = value;
|
r->settings.pack_use_sparse = value;
|
||||||
|
UPDATE_DEFAULT_BOOL(r->settings.pack_use_sparse, 1);
|
||||||
|
|
||||||
if (!repo_config_get_bool(r, "feature.manyfiles", &value) && value) {
|
if (!repo_config_get_bool(r, "feature.manyfiles", &value) && value) {
|
||||||
UPDATE_DEFAULT_BOOL(r->settings.index_version, 4);
|
UPDATE_DEFAULT_BOOL(r->settings.index_version, 4);
|
||||||
UPDATE_DEFAULT_BOOL(r->settings.core_untracked_cache, UNTRACKED_CACHE_WRITE);
|
UPDATE_DEFAULT_BOOL(r->settings.core_untracked_cache, UNTRACKED_CACHE_WRITE);
|
||||||
|
@ -52,7 +54,6 @@ void prepare_repo_settings(struct repository *r)
|
||||||
if (!repo_config_get_bool(r, "fetch.writecommitgraph", &value))
|
if (!repo_config_get_bool(r, "fetch.writecommitgraph", &value))
|
||||||
r->settings.fetch_write_commit_graph = value;
|
r->settings.fetch_write_commit_graph = value;
|
||||||
if (!repo_config_get_bool(r, "feature.experimental", &value) && value) {
|
if (!repo_config_get_bool(r, "feature.experimental", &value) && value) {
|
||||||
UPDATE_DEFAULT_BOOL(r->settings.pack_use_sparse, 1);
|
|
||||||
UPDATE_DEFAULT_BOOL(r->settings.fetch_negotiation_algorithm, FETCH_NEGOTIATION_SKIPPING);
|
UPDATE_DEFAULT_BOOL(r->settings.fetch_negotiation_algorithm, FETCH_NEGOTIATION_SKIPPING);
|
||||||
UPDATE_DEFAULT_BOOL(r->settings.fetch_write_commit_graph, 1);
|
UPDATE_DEFAULT_BOOL(r->settings.fetch_write_commit_graph, 1);
|
||||||
}
|
}
|
||||||
|
|
6
t/README
6
t/README
|
@ -386,9 +386,9 @@ GIT_TEST_INDEX_VERSION=<n> exercises the index read/write code path
|
||||||
for the index version specified. Can be set to any valid version
|
for the index version specified. Can be set to any valid version
|
||||||
(currently 2, 3, or 4).
|
(currently 2, 3, or 4).
|
||||||
|
|
||||||
GIT_TEST_PACK_SPARSE=<boolean> if enabled will default the pack-objects
|
GIT_TEST_PACK_SPARSE=<boolean> if disabled will default the pack-objects
|
||||||
builtin to use the sparse object walk. This can still be overridden by
|
builtin to use the non-sparse object walk. This can still be overridden by
|
||||||
the --no-sparse command-line argument.
|
the --sparse command-line argument.
|
||||||
|
|
||||||
GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path
|
GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path
|
||||||
by overriding the minimum number of cache entries required per thread.
|
by overriding the minimum number of cache entries required per thread.
|
||||||
|
|
|
@ -105,14 +105,16 @@ test_expect_success 'non-sparse pack-objects' '
|
||||||
test_cmp required_objects.txt nonsparse_required_objects.txt
|
test_cmp required_objects.txt nonsparse_required_objects.txt
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# --sparse is enabled by default by pack.useSparse
|
||||||
test_expect_success 'sparse pack-objects' '
|
test_expect_success 'sparse pack-objects' '
|
||||||
|
GIT_TEST_PACK_SPARSE=-1 &&
|
||||||
git rev-parse \
|
git rev-parse \
|
||||||
topic1 \
|
topic1 \
|
||||||
topic1^{tree} \
|
topic1^{tree} \
|
||||||
topic1:f3 \
|
topic1:f3 \
|
||||||
topic1:f3/f4 \
|
topic1:f3/f4 \
|
||||||
topic1:f3/f4/data.txt | sort >expect_sparse_objects.txt &&
|
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 index-pack -o sparse.idx sparse.pack &&
|
||||||
git show-index <sparse.idx | awk "{print \$2}" >sparse_objects.txt &&
|
git show-index <sparse.idx | awk "{print \$2}" >sparse_objects.txt &&
|
||||||
test_cmp expect_sparse_objects.txt sparse_objects.txt
|
test_cmp expect_sparse_objects.txt sparse_objects.txt
|
||||||
|
|
Loading…
Reference in New Issue