mirror of
https://github.com/git/git
synced 2024-08-24 10:15:51 +00:00
Merge branch 'bp/untracked-cache-noflush'
Writing out the index file when the only thing that changed in it is the untracked cache information is often wasteful, and this has been optimized out. * bp/untracked-cache-noflush: untracked cache: use git_env_bool() not getenv() for customization dir.c: don't flag the index as dirty for changes to the untracked cache
This commit is contained in:
commit
cdda65acae
15
dir.c
15
dir.c
|
@ -2172,8 +2172,13 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
|
||||||
const struct pathspec *pathspec)
|
const struct pathspec *pathspec)
|
||||||
{
|
{
|
||||||
struct untracked_cache_dir *root;
|
struct untracked_cache_dir *root;
|
||||||
|
static int untracked_cache_disabled = -1;
|
||||||
|
|
||||||
if (!dir->untracked || getenv("GIT_DISABLE_UNTRACKED_CACHE"))
|
if (!dir->untracked)
|
||||||
|
return NULL;
|
||||||
|
if (untracked_cache_disabled < 0)
|
||||||
|
untracked_cache_disabled = git_env_bool("GIT_DISABLE_UNTRACKED_CACHE", 0);
|
||||||
|
if (untracked_cache_disabled)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2297,7 +2302,12 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
|
||||||
|
|
||||||
trace_performance_since(start, "read directory %.*s", len, path);
|
trace_performance_since(start, "read directory %.*s", len, path);
|
||||||
if (dir->untracked) {
|
if (dir->untracked) {
|
||||||
|
static int force_untracked_cache = -1;
|
||||||
static struct trace_key trace_untracked_stats = TRACE_KEY_INIT(UNTRACKED_STATS);
|
static struct trace_key trace_untracked_stats = TRACE_KEY_INIT(UNTRACKED_STATS);
|
||||||
|
|
||||||
|
if (force_untracked_cache < 0)
|
||||||
|
force_untracked_cache =
|
||||||
|
git_env_bool("GIT_FORCE_UNTRACKED_CACHE", 0);
|
||||||
trace_printf_key(&trace_untracked_stats,
|
trace_printf_key(&trace_untracked_stats,
|
||||||
"node creation: %u\n"
|
"node creation: %u\n"
|
||||||
"gitignore invalidation: %u\n"
|
"gitignore invalidation: %u\n"
|
||||||
|
@ -2307,7 +2317,8 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
|
||||||
dir->untracked->gitignore_invalidated,
|
dir->untracked->gitignore_invalidated,
|
||||||
dir->untracked->dir_invalidated,
|
dir->untracked->dir_invalidated,
|
||||||
dir->untracked->dir_opened);
|
dir->untracked->dir_opened);
|
||||||
if (dir->untracked == istate->untracked &&
|
if (force_untracked_cache &&
|
||||||
|
dir->untracked == istate->untracked &&
|
||||||
(dir->untracked->dir_opened ||
|
(dir->untracked->dir_opened ||
|
||||||
dir->untracked->gitignore_invalidated ||
|
dir->untracked->gitignore_invalidated ||
|
||||||
dir->untracked->dir_invalidated))
|
dir->untracked->dir_invalidated))
|
||||||
|
|
|
@ -14,6 +14,9 @@ test_description='test untracked cache'
|
||||||
# See <20160803174522.5571-1-pclouds@gmail.com> if you want to know
|
# See <20160803174522.5571-1-pclouds@gmail.com> if you want to know
|
||||||
# more.
|
# more.
|
||||||
|
|
||||||
|
GIT_FORCE_UNTRACKED_CACHE=true
|
||||||
|
export GIT_FORCE_UNTRACKED_CACHE
|
||||||
|
|
||||||
sync_mtime () {
|
sync_mtime () {
|
||||||
find . -type d -ls >/dev/null
|
find . -type d -ls >/dev/null
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue