summaryrefslogtreecommitdiff
path: root/t/helper/test-read-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 't/helper/test-read-cache.c')
-rw-r--r--t/helper/test-read-cache.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index 6cfd8f2..b52c174 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -4,6 +4,7 @@
#include "blob.h"
#include "commit.h"
#include "tree.h"
+#include "sparse-index.h"
static void print_cache_entry(struct cache_entry *ce)
{
@@ -35,13 +36,19 @@ int cmd__read_cache(int argc, const char **argv)
struct repository *r = the_repository;
int i, cnt = 1;
const char *name = NULL;
- int table = 0;
+ int table = 0, 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))
continue;
if (!strcmp(*argv, "--table"))
table = 1;
+ else if (!strcmp(*argv, "--expand"))
+ expand = 1;
}
if (argc == 1)
@@ -51,6 +58,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;