zsh-git-prompt
zsh-git-prompt copied to clipboard
Long delay back to prompt for large repositories
I am working with a large repository containing tens of thousands of directories. As long as the cwd is located in that directory the prompt will return after a delay of ~10 seconds. With other git repositories this does not happen.
I tried running the same git command the plugin seems to be running:
time git status --porcelain --branch
and i see that the reported elpased time is ~10 seconds, which convinced me that the root cause of the slowness is git and not the plugin.
Next, i tried running the original command with '-uno' which will not report untracked files:
time git status --porcelain --branch -uno
And the elapsed time for that experiment was less than one second.
As a user i would like to have an option to ignore untracked information to allow better performance.
Thanks for that, that's a very interesting idea indeed. We should definitely consider not giving information about untracked files as an option.
Do you know what explains that enormous difference? Are there many untracked files in your case?
I took a look at my working copy where this issue was reproduced and there were less than 400 untracked files, which seems to be negligible compared to the tens of thousands of tracked directories and files. So i am guessing that the cost here is walking the filesystem and looking for untracked files, rather than processing the untracked files which were discovered.
What happens if you use git status --porcelain --untracked-files=no --branch
? Is it significantly faster?
If it is, we should add an option to use that instead.
Isn't it the same command? From the man page -u[<mode>], --untracked-files[=<mode>]
.
The essential part is --untracked-files=no
That's what I meant. Although --untracked-files=no
is more logical given that the other options are in long form too, -uno
is the short form and has exactly the same effect.
I'm interested in this option for git-super-status
and I was just trying to spare you 2 some time by pointing the fact that what you ask is the same thing as the first test. :smiley:
Oooooh! I see, sorry, now I understand.
Brilliant, so the solution to get a faster git-status is to use this -uno
option. Thanks for the clarification.
Can't wait to see an update with this!
In 045d5a5deff183dbe131867b67f744b177e0997c, the call to git
is now in the zshrc
file, only for the Haskell version for now. So if you install the Haskell version (should be easy with stack), and add the -uno
flag to zshrc, this should speed up the display of the prompt.
Let me know if any of you has a nicer solution, which would activate -uno
only on certain directories...
Would it be possible to avoid using the prompt on some repositories? Eg with a ".nogitzsh" file? Every time I enter my Kernel source tree on NFS, I've got to press CTRL+C to be able to do anything...