Skip to content

Commit 7e993e5

Browse files
committed
dir: force untracked cache with core.untrackedCache
The GIT_FORCE_UNTRACKED_CACHE environment variable write the untracked cache more frequently than the core.untrackedCache config variable. This is due to how read_directory() handles the creation of an untracked cache. The old mechanism required using something like 'git update-index --untracked-cache' before the index would actually contain an untracked cache. This was noted as a performance problem on macOS in the past, and this is the resolution for that issue. Signed-off-by: Derrick Stolee <[email protected]>
1 parent 597cd7b commit 7e993e5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,9 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
29942994

29952995
if (force_untracked_cache < 0)
29962996
force_untracked_cache =
2997-
git_env_bool("GIT_FORCE_UNTRACKED_CACHE", 0);
2997+
git_env_bool("GIT_FORCE_UNTRACKED_CACHE", -1);
2998+
if (force_untracked_cache < 0)
2999+
force_untracked_cache = (istate->repo->settings.core_untracked_cache == UNTRACKED_CACHE_WRITE);
29983000
if (force_untracked_cache &&
29993001
dir->untracked == istate->untracked &&
30003002
(dir->untracked->dir_opened ||

0 commit comments

Comments
 (0)