From 9e3d5cfa14f3de777c82170ef2281ad5fce5b0b9 Mon Sep 17 00:00:00 2001 From: fred wong Date: Fri, 24 Feb 2012 14:26:11 +0800 Subject: [PATCH] Include git-stash status at command line --- lib/git.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index fb4ad8ca6..410948309 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -1,7 +1,7 @@ # get the name of the branch we are on function git_prompt_info() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$(parse_git_stash)$ZSH_THEME_GIT_PROMPT_SUFFIX" } @@ -18,6 +18,14 @@ parse_git_dirty() { fi } +# Checks if working tree contains stash(es) +parse_git_stash() { + if [[ -n $(git stash list 2> /dev/null) ]]; then + echo "$ZSH_THEME_GIT_PROMPT_HAVE_STASH" + else + echo "$ZSH_THEME_GIT_PROMPT_HAVE_NO_STASH" + fi +} # Checks if there are commits ahead from remote function git_prompt_ahead() {