lib/git.zsh: Allow themes to opt-out of an expensive git status call

If neither DIRTY nor CLEAN is defined then this function is a noop,
so check up-front before making the call.

This speeds up prompts that empty out these values.
This commit is contained in:
David Aguilar 2012-04-01 20:28:58 -07:00
commit a481661251

View file

@ -8,6 +8,11 @@ function git_prompt_info() {
# Checks if working tree is dirty
parse_git_dirty() {
if [[ -z "$ZSH_THEME_GIT_PROMPT_DIRTY" &&
-z "$ZSH_THEME_GIT_PROMPT_CLEAN" ]]; then
return
fi
local SUBMODULE_SYNTAX=''
local GIT_STATUS=''
local CLEAN_MESSAGE='nothing to commit (working directory clean)'