diff options
| author | Derrick Stolee <stolee@gmail.com> | 2025-05-16 18:11:58 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-16 12:15:39 -0700 |
| commit | 4f7f57120428c0dfcbda85bc8afcd4d1740139dd (patch) | |
| tree | d1ea50b73982c07d9e2d57c1af97283d76c18031 /builtin/pack-objects.c | |
| parent | repack: add --path-walk option (diff) | |
| download | git-4f7f57120428c0dfcbda85bc8afcd4d1740139dd.tar.gz git-4f7f57120428c0dfcbda85bc8afcd4d1740139dd.zip | |
pack-objects: enable --path-walk via config
Users may want to enable the --path-walk option for 'git pack-objects' by
default, especially underneath commands like 'git push' or 'git repack'.
This should be limited to client repositories, since the --path-walk option
disables bitmap walks, so would be bad to include in Git servers when
serving fetches and clones. There is potential that it may be helpful to
consider when repacking the repository, to take advantage of improved deltas
across historical versions of the same files.
Much like how "pack.useSparse" was introduced and included in
"feature.experimental" before being enabled by default, use the repository
settings infrastructure to make the new "pack.usePathWalk" config enabled by
"feature.experimental" and "feature.manyFiles".
In order to test that this config works, add a new trace2 region around
the path walk code that can be checked by a 'git push' command.
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
| -rw-r--r-- | builtin/pack-objects.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 4fd88476dd..bdd20c074a 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -44,6 +44,7 @@ #include "blob.h" #include "tree.h" #include "path-walk.h" +#include "trace2.h" /* * Objects we are going to pack are collected in the `to_pack` structure. @@ -4283,6 +4284,7 @@ static void get_object_list_path_walk(struct rev_info *revs) { struct path_walk_info info = PATH_WALK_INFO_INIT; unsigned int processed = 0; + int result; info.revs = revs; info.path_fn = add_objects_by_path; @@ -4296,7 +4298,11 @@ static void get_object_list_path_walk(struct rev_info *revs) */ info.prune_all_uninteresting = sparse; - if (walk_objects_by_path(&info)) + trace2_region_enter("pack-objects", "path-walk", revs->repo); + result = walk_objects_by_path(&info); + trace2_region_leave("pack-objects", "path-walk", revs->repo); + + if (result) die(_("failed to pack objects via path-walk")); } @@ -4652,6 +4658,9 @@ int cmd_pack_objects(int argc, if (use_bitmap_index > 0 || !use_internal_rev_list) path_walk = 0; + else if (the_repository->gitdir && + the_repository->settings.pack_use_path_walk) + path_walk = 1; else path_walk = git_env_bool("GIT_TEST_PACK_PATH_WALK", 0); } |
