I am using git for source control on a repository. Recently it has begun warning me about how long it takes to enumerate untracked files when using git status:
$ git status On branch my_branch Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: My_Project/my_source.c It took 3.24 seconds to enumerate untracked files. 'status -uno' may speed it up, but you have to be careful not to forget to add new files yourself (see 'git help status'). no changes added to commit (use "git add" and/or "git commit -a") However, there are no untracked files in this repository – I checked with git status -uall. Some other possibly relevant information:
- I've noted that this warning only appears when
git statusdoes indeed take a few seconds to run. - My repository is 130.6 MB at the moment.
- My build products are all out-of-tree.
Why does git take so long to enumerate untracked files that do not exist?
Here are some relevant other questions:
.gitignoreand friends. The size of your repository doesn't really matter, sincegit statusonlylstat()s your files. What matters is how many files there are, how deeply nested your directory tree is and how fast your filesystem is.