[PATCH 22/30] pack-objects: introduce GIT_TEST_PACK_PATH_WALK
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Sep 10, 2024, 02:28 UTC
- Message-ID
- <b52ee338d1524a938e679fdeedc04818b75fd4d5.1725935335.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1786.git.1725935335.gitgitgadget@gmail.com>
From: Derrick Stolee <stolee@gmail.com>
There are many tests that validate whether 'git pack-objects' works as expected. Instead of duplicating these tests, add a new test environment variable, GIT_TEST_PACK_PATH_WALK, that implies --path-walk by default when specified.
This was useful in testing the implementation of the --path-walk implementation, especially in conjunction with test such as:
- t5322-pack-objects-sparse.sh : This demonstrates the effectiveness of the --sparse option and how it combines with --path-walk.
RFC TODO: list other helpful test cases, as well as the ones where the behavior breaks if this is enabled...
Signed-off-by: Derrick Stolee <stolee@gmail.com> --- builtin/pack-objects.c | 1 + t/README | 4 ++++ 2 files changed, 5 insertions(+)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index b1d684c3417..b9fe1b1fbd5 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -4534,6 +4534,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) disable_replace_refs(); + path_walk = git_env_bool("GIT_TEST_PACK_PATH_WALK", 0); sparse = git_env_bool("GIT_TEST_PACK_SPARSE", -1); if (the_repository->gitdir) { prepare_repo_settings(the_repository); diff --git a/t/README b/t/README index 44c02d81298..a5d7d0239e0 100644 --- a/t/README +++ b/t/README @@ -433,6 +433,10 @@ GIT_TEST_PACK_SPARSE=<boolean> if disabled will default the pack-objects builtin to use the non-sparse object walk. This can still be overridden by the --sparse command-line argument. +GIT_TEST_PACK_PATH_WALK=<boolean> if enabled will default the pack-objects +builtin to use the path-walk API for the object walk. This can still be +overridden by the --no-path-walk command-line argument. + GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path by overriding the minimum number of cache entries required per thread.
-- gitgitgadget