From: Devste Devste Date: Sun, 05 Oct 2025 11:14:52 GMT Subject: Re: Untracked files cache not used when --untracked-files is used Message-ID: In-Reply-To: Thank you, this solved the problem indeed, status.showUntrackedFiles was not set at all in my case. However: it did not work/update the cache initially with the command the IDE/GUI usually runs: git config status.showUntrackedFiles all time git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks status --porcelain --ignore-submodules=dirty --untracked-files=all --no-ahead-behind real 0m3.463s user 0m0.000s sys 0m0.000s time git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks status --porcelain --ignore-submodules=dirty --untracked-files=all --no-ahead-behind real 0m3.423s user 0m0.031s sys 0m0.015s time git status --untracked-files ... It took 3.41 seconds to enumerate untracked files, but the results were cached, and subsequent runs may be faster. See 'git help status' for information on how to improve this. ... real 0m3.691s user 0m0.000s sys 0m0.015s time git status --untracked-files ... real 0m0.773s user 0m0.000s sys 0m0.000s time git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks status --porcelain --ignore-submodules=dirty --untracked-files=all --no-ahead-behind ... real 0m0.818s user 0m0.000s sys 0m0.015s --- One of --no-optional-locks --porcelain --ignore-submodules=dirty --no-ahead-behind causes it to not update the cache it seems. Unfortunately, I cannot tell which exactly, because now, even when unsetting status.showUntrackedFiles it uses the cache for --untracked-files=all This means, that if the untracked cache was created with status.showUntrackedFiles all, it will always use the untracked-files cache for --untracked-files On Sun, 5 Oct 2025 at 02:20, Matthew Hughes wrote: > > Devste Devste wrote: > > It seems that using --untracked-files(=all) causes it to either not > > use the untracked files cache (or untracked files are not stored in > > the untracked files cache if they are in an untracked directory?) > > Since various tools and IDEs use that hardcoded, fixing this would be > > a massive performance boost for many users > > What's the value of your `status.showUntrackedFiles` config var? I ask because > I looked around a bit and found commit e6a653554bb49c26d105f3b478cbdbb1c0648f65 > (untracked-cache: support '--untracked-files=all' if configured), which > includes: > > > For most users there will be no change in behavior. Users who need > > '--untracked-files=all' to perform well will now have the option of > > setting "status.showuntrackedfiles" to "all" for better / more > > consistent performance. > > Testing this out on a big repo (on my Linux machine): > > $ git init . > # create ~100_000 files with plenty of directories > $ for i in {1..10000}; do echo dir_$i/{1,2,3,4}/nested_{1,2}; done | xargs mkdir -p > $ for i in {1..10000}; do echo dir_$i/{foo,bar,baz}/file.txt; done | xargs touch > $ git add . > > As expected, status with untracked files and no untracked cache is rather slow: > > $ time GIT_CONFIG_GLOBAL=/dev/null git status --untracked-files=all >/dev/null > > real 0m1.237s > user 0m0.484s > sys 0m1.150s > > Status with untracked files and `core.untrackedCache=true` is just as slow: > > $ time GIT_CONFIG_GLOBAL=/dev/null git -c 'core.untrackedCache=true' status --untracked-files=all >/dev/null > > real 0m1.250s > user 0m0.435s > sys 0m1.216s > > However, with `status.untrackedFiles=all` (i.e. matching the `--untracked-files` flag) it's much quicker: > > $ time GIT_CONFIG_GLOBAL=/dev/null git -c 'core.untrackedCache=true' -c 'status.showUntrackedFiles=all' status --untracked-files=all >/dev/null > > real 0m0.382s > user 0m0.214s > sys 0m0.568s