Skip to content

Commit

Permalink
dir: force untracked cache with core.untrackedCache
Browse files Browse the repository at this point in the history
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 <dstolee@microsoft.com>
  • Loading branch information
derrickstolee committed Nov 4, 2021
1 parent 4b47995 commit 9ea0015
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -3053,7 +3053,9 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,

if (force_untracked_cache < 0)
force_untracked_cache =
git_env_bool("GIT_FORCE_UNTRACKED_CACHE", 0);
git_env_bool("GIT_FORCE_UNTRACKED_CACHE", -1);
if (force_untracked_cache < 0)
force_untracked_cache = (istate->repo->settings.core_untracked_cache == UNTRACKED_CACHE_WRITE);
if (force_untracked_cache &&
dir->untracked == istate->untracked &&
(dir->untracked->dir_opened ||
Expand Down

0 comments on commit 9ea0015

Please sign in to comment.