On Wed, Jun 9, 2021 at 4:22 PM Roman Perepelitsa wrote: > > A few questions/comments after a cursory look. > > Why is prompt_vcs_chpwd using exec + read instead of $(...)? Because I apparently forgot that $(...) runs in a subshell, too. ^_^; > Why hook zle-line-init instead of precmd? There is a comment saying > that it's "so you can press Enter on an empty line to update VCS info" > but I don't understand it. When I press Enter in zle with an empty > buffer, precmd does get called. I could've sworn that precmd doesn't get called under those conditions, but I guess I confused it with preexec. > There is a race that may cause incorrect git status to be displayed. > For example, suppose I run these commands in quick succession in a > large git repository: > > git checkout -b foo > git checkout -b bar > > If the two background vcs processes finish out of order, prompt will > incorrectly display "foo" when the current branch is "bar". This error > will persist until another command (perhaps empty) is executed. > > Pressing and holding Enter in a large repository may cause large (and > unbounded) strain on the machine. Thanks for the review! Here's a new version of the patch that hopefully addresses the concerns you raised.