Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git prompt extremely slow on git repos with lots of commits. #8979

Closed
phryk opened this issue May 29, 2022 · 2 comments
Closed

git prompt extremely slow on git repos with lots of commits. #8979

phryk opened this issue May 29, 2022 · 2 comments

Comments

@phryk
Copy link

phryk commented May 29, 2022

Meta

Fish: 3.4.1
OS: FreeBSD 13.0
Terminal: rxvt-unicode

No third-party customizations.

Reproduction

Use one of the predefined prompts showing git info, like "Informative Vcs" or "Terlar".

git clone https://git.freebsd.org/ports.git
cd ports

Expected behavior

Change directory and give me access to my shell back, fast.

Actual behavior

Shell session blocked for ~15s.

Fix

Have __terlar_git_prompt and fish_git_prompt pass -uno to git status,
which makes it ignore untracked files. This speeds up the prompt generation
by a factor of something like 30-100, even when no untracked files are around.

fish_git_prompt has some settings that would make this invalid behavior
(show_informative_status, showuntrackedfiles), but -uno should at least
be the default because it makes the prompt on big repos so much faster.

I would also argue that a timeout like proposed by @cg505 and @krobelus
in #6764 should be wrapped around calls to prompt functions.

@ridiculousfish ridiculousfish added this to the fish-future milestone May 29, 2022
@IlanCosman
Copy link
Contributor

Not that this solves the problem, since the default prompts should still be responsive, but you might want to check out https://github.com/IlanCosman/tide, which has an async git prompt. 0 delay ever, always have access to your shell. Sorry for the plug, just want to make sure you have a good fish experience 😅

@faho
Copy link
Member

faho commented May 30, 2022

If -uno helps, your problem isn't lots of commits - it's lots of files.

And the normal fish_git_prompt already doesn't care about untracked files, it requires you to specifically set $__fish_git_prompt_showuntrackedfiles (and to not have git's bash.showuntrackedfiles option set to false on that repo).

What you're using however is the informative mode (which the informative sample prompt turns on). In this mode it's meant to count all the files. We pass "-unormal" (not "-uno") to not descend into untracked directories. If we passed -uno instead it wouldn't count untracked files at all, which doesn't seem right. (for historical reasons, the terlar prompt has its own git prompt implementation - I've been working on unifying the two)

The fish_git_prompt documentation already tells you that informative mode might be slow, and already explains you can disable it per-repo with:

git config --local bash.showInformativeStatus false

So really, what we could do, other than 6764, is to remove the informative prompt so at least you'd have to enable informative mode yourself. (we should also either remove or unify the terlar prompt because it does unnecessary work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants