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`
This commit is contained in:
Junio C Hamano
2022-08-03 13:36:07 -07:00
2 changed files with 7 additions and 0 deletions

View File

@ -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;
}