Skip to content
Browse files

Merge pull request #1654 from bertag/parse-git-dirty-support-for-1.6

parse_git_dirty() support for Git 1.6
  • Loading branch information...
2 parents dda1154 + 72ec241 commit cd55560c74820cdf4fa269dab4126b27c732573b @robbyrussell committed Apr 7, 2013
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/git.zsh
View
11 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

0 comments on commit cd55560

Please sign in to comment.
Something went wrong with that request. Please try again.