Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Add customizable `vcs` prompt theme (was Re: [RFC][PATCH] `newuser` prompt theme)



On Wed, Jun 9, 2021 at 2:59 PM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
>
> I decided to make some simplifications to this prompt theme. Here's a new version of the patch.

A few questions/comments after a cursory look.

Why is prompt_vcs_chpwd using exec + read instead of $(...)?

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.

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.

Roman.




Messages sorted by: Reverse Date, Date, Thread, Author