[PATCH 06/27] test-tool: don't force full index
flat view
STALE2071d
From: Derrick Stolee via GitGitGadget <hidden>
Date: 2021-01-25 17:56:15
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Derrick Stolee <redacted> We will use 'test-tool read-cache --table' to check that a sparse index is written as part of init_repos. Since we will no longer always expand a sparse index into a full index, add an '--expand' parameter that adds a call to ensure_full_index() so we can compare a sparse index directly against a full index, or at least what the in-memory index looks like when expanded in this way. Signed-off-by: Derrick Stolee <redacted> --- t/helper/test-read-cache.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index f858d0d0a0c..3c45dfeb3cb 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c@@ -1,6 +1,7 @@ #include "test-tool.h" #include "cache.h" #include "config.h" +#include "sparse-index.h" static void print_cache_entry(struct cache_entry *ce, unsigned stat) {
@@ -44,6 +45,11 @@ int cmd__read_cache(int argc, const char **argv) const char *name = NULL; int table = 0; int stat = 1; + int expand = 0; + + initialize_the_repository(); + prepare_repo_settings(r); + r->settings.command_requires_full_index = 0; for (++argv, --argc; *argv && starts_with(*argv, "--"); ++argv, --argc) { if (skip_prefix(*argv, "--print-and-refresh=", &name))
@@ -52,6 +58,8 @@ int cmd__read_cache(int argc, const char **argv) table = 1; else if (!strcmp(*argv, "--no-stat")) stat = 0; + else if (!strcmp(*argv, "--expand")) + expand = 1; } if (argc == 1)
@@ -61,6 +69,10 @@ int cmd__read_cache(int argc, const char **argv) for (i = 0; i < cnt; i++) { repo_read_index(r); + + if (expand) + ensure_full_index(r->index); + if (name) { int pos;
--
gitgitgadget