summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbertag <scott_bertagnole@byu.edu>2013-03-11 13:41:32 -0600
committerbertag <scott_bertagnole@byu.edu>2013-03-11 13:41:32 -0600
commit72ec24108a88d79a13cc3581f17b440418048a72 (patch)
treea47103e8bbed6fd3dbe6d1306c3e0a4171ab6924 /lib
parent0ab0e67ecfc52b4779b700149a9c51feeb05318e (diff)
downloadzsh-72ec24108a88d79a13cc3581f17b440418048a72.tar.gz
zsh-72ec24108a88d79a13cc3581f17b440418048a72.tar.bz2
zsh-72ec24108a88d79a13cc3581f17b440418048a72.zip
Tweaked parse_git_dirty() in lib/git.zsh to support proper dirty/clean parsing against both git 1.6 and git 1.7+
Diffstat (limited to 'lib')
-rw-r--r--lib/git.zsh11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/git.zsh b/lib/git.zsh
index 3e14695bd..172bf4f7a 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -9,16 +9,19 @@ function git_prompt_info() {
# Checks if working tree is dirty
parse_git_dirty() {
local SUBMODULE_SYNTAX=''
+ local GIT_STATUS=''
+ local CLEAN_MESSAGE='nothing to commit (working directory clean)'
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
- fi
- if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
+ fi
+ GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
+ if [[ -n $GIT_STATUS && "$GIT_STATUS" != "$CLEAN_MESSAGE" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
- fi
- fi
+ fi
+ fi
}
# get the difference between the local and remote branches