bash-git-prompt
bash-git-prompt copied to clipboard
Show prompt, then check git and update prompt with \r
Awesome project!
It's a bit slow for me so I was wondering if the following could be done:
Have the prompt be shown immediately (without notifying whether or not there are changes, or perhaps showing the previously known status of the repo). Then, once the prompt is showing, only then check whether there are git changes. If there are, the prompt can be updated -- perhaps by \r
to alter it on the same line.
If this worked or some other method to speed up the prompt in general, I'd love to use this and share with others! I've also set GIT_PROMPT_SHOW_UNTRACKED_FILES=no
but even directories without git load the prompt a little slowly.
Thanks!
+1 on this request. I regularly work on a large repository where running git status
takes almost 6 seconds (stored on an SSD). git branch
still returns immediately, if the prompt could be shown with the branch, and later amended once the call to git status
returns, that would make it usable on large repositories.
The downside to this is that some of the prompt would have to be split out into a separate background task, and rewriting the prompt line without erasing text the user has input in the meantime could be a challenge.
Are you using WSL? WSL has shown to be pretty slow with this project.
No, I'm on macOS (iTerm)
I especially notice the slowdown when first cding into a repo. At least in that case, I would be happy for the prompt to show an hourglass while a background job was running. If I wanted to wait for the status, I could just hit Enter until the prompt changed to show the results of the background job.
Note proposed idea wouldn't be universal as multi-line prompts might get broken. Still, would be a great opt-in option.