summaryrefslogtreecommitdiffstats
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-08-03 22:36:07 +0200
committerJunio C Hamano <gitster@pobox.com>2022-08-03 22:36:07 +0200
commitf1a0db23ad269d46ae43fd34d04ab6065081a92f (patch)
tree09bf24edbd920f6120f6b890c61a5381f961a6ad /read-cache.c
parentMerge branch 'pw/xdiff-alloc' (diff)
parentread-cache: make `do_read_index()` always set up `istate->repo` (diff)
downloadgit-f1a0db23ad269d46ae43fd34d04ab6065081a92f.tar.xz
git-f1a0db23ad269d46ae43fd34d04ab6065081a92f.zip
Merge branch 'tk/untracked-cache-with-uall'
Fix for a bug that makes write-tree to fail to write out a non-existent index as a tree, introduced in 2.37. * tk/untracked-cache-with-uall: read-cache: make `do_read_index()` always set up `istate->repo`
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 76f372ff91..4de207752d 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2294,6 +2294,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;
}