From 4891bf41fdd05408d55af7dd5b7927fd7068c2f3 Mon Sep 17 00:00:00 2001 From: Eli Block <3347571+eliblock@users.noreply.github.com> Date: Thu, 14 May 2020 17:37:47 -0700 Subject: [PATCH] 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. --- themes/agnoster.zsh-theme | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 8c700d06a..2b1ea6d11 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -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'