summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index 06e5b06e63..b09128b188 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2299,6 +2299,8 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
fd = open(path, O_RDONLY);
if (fd < 0) {
if (!must_exist && errno == ENOENT) {
+ if (!istate->repo)
+ istate->repo = the_repository;
set_new_index_sparsity(istate);
return 0;
}