From a481661251fc48dbd8f28e23fb2d4e2fbd3d1e80 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 1 Apr 2012 20:28:58 -0700 Subject: [PATCH] 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. --- lib/git.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index b8b5bab61..148695643 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -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)'