git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Untracked files cache not used when --untracked-files is used

From
Matthew Hughes <matthewhughes934@gmail.com>
Date
Oct 5, 2025, 00:20 UTC
Message-ID
<lrahpvp3nj4rtewf3zbf67qsvwhc4mg6irbmrhklbizxbhqwom@cc25oeqex4il>
In-Reply-To
<CANM0SV3+4k5tsgRw0g8-HoVSFGb1AwZr+2hCUXLriFGSd33WQQ@mail.gmail.com>
Devste Devste wrote:
Show 5 quoted lines
> 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
Previous: Devste DevsteNext: Devste Devste
Message 2 of 5 in “Untracked files cache not used when --untracked-files is used”
  1. Devste DevsteOct 3, 2025
  2. Matthew HughesOct 5, 2025
  3. Devste DevsteOct 5, 2025
  4. Matthew HughesOct 6, 2025
  5. Devste DevsteOct 7, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.