Merge pull request #1654 from bertag/parse-git-dirty-support-for-1.6
parse_git_dirty() support for Git 1.6
Diff
1diff --git a/lib/git.zsh b/lib/git.zsh
2index 98c00bd8afed398b26e991e24d5d4e2060f0e7c7..76fe9b142cb35fb8d88f5a9e9cf9830ff5abb333 100644
3--- a/lib/git.zsh
4+++ b/lib/git.zsh
5@@ -9,16 +9,19 @@ function git_prompt_info() {
6 # Checks if working tree is dirty
7 parse_git_dirty() {
8 local SUBMODULE_SYNTAX=''
9+ local GIT_STATUS=''
10+ local CLEAN_MESSAGE='nothing to commit (working directory clean)'
11 if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
12 if [[ $POST_1_7_2_GIT -gt 0 ]]; then
13 SUBMODULE_SYNTAX="--ignore-submodules=dirty"
14- fi
15- if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
16+ fi
17+ GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
18+ if [[ -n $GIT_STATUS && "$GIT_STATUS" != "$CLEAN_MESSAGE" ]]; then
19 echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
20 else
21 echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
22- fi
23- fi
24+ fi
25+ fi
26 }
2728 # get the difference between the local and remote branches