fix: respect parse_git_dirty clean result

$dirty will be empty if parse_git_dirty returns a clean result - which
may happen because the working directory is clean or because a
configuration has been set (e.g., oh-my-zsh.hide-dirty) which disables
the check. In either event, we should respect the former check and avoid
querying for a dirty working directory a second time.
This commit is contained in:
Eli Block 2020-05-14 17:37:47 -07:00
parent fd786291ba
commit 4891bf41fd

View file

@ -129,7 +129,11 @@ prompt_git() {
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true
if [[ -z $dirty ]]; then
zstyle ':vcs_info:*' check-for-staged-changes true
else
zstyle ':vcs_info:*' check-for-changes true
fi
zstyle ':vcs_info:*' stagedstr '✚'
zstyle ':vcs_info:*' unstagedstr '●'
zstyle ':vcs_info:*' formats ' %u%c'