bash-git-prompt icon indicating copy to clipboard operation
bash-git-prompt copied to clipboard

Show prompt, then check git and update prompt with \r

Open samyk opened this issue 5 years ago • 5 comments

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!

samyk avatar Jul 23 '18 01:07 samyk

+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.

spiritualized avatar Jan 08 '19 18:01 spiritualized

Are you using WSL? WSL has shown to be pretty slow with this project.

krazyito65 avatar Jan 28 '19 21:01 krazyito65

No, I'm on macOS (iTerm)

samyk avatar Jan 28 '19 21:01 samyk

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.

cxw42 avatar Sep 18 '20 18:09 cxw42

Note proposed idea wouldn't be universal as multi-line prompts might get broken. Still, would be a great opt-in option.

laur89 avatar Oct 22 '20 15:10 laur89