summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--01_Internal.zsh16
-rw-r--r--12_Prompts.zsh3
2 files changed, 10 insertions, 9 deletions
diff --git a/01_Internal.zsh b/01_Internal.zsh
index 183a970..0d0babb 100644
--- a/01_Internal.zsh
+++ b/01_Internal.zsh
@@ -300,10 +300,12 @@ __get_git_status ()
return
fi
- if [ "$(git diff --cached 2>&- | grep '^diff ' | head -n1 )" != "" ] ; then
+ if [ "$(git status --porcelain | cut -c1 | tr -d ' ?\n')" != "" ] ; then
+ # Got any character but « » or «?» in first column : staged changes
cached="yes"
fi
- if [ "$(git ls-files -m 2>&- | head -n1)" != "" ] ; then
+ if [ "$(git status --porcelain | cut -c2 | tr -d ' ?\n')" != "" ] ; then
+ # Got any character but « » or «?» in second column : working tree changes
changed="yes"
fi
@@ -353,14 +355,14 @@ __zsh_status ()
then
cd $ZDOTDIR >/dev/null
_status="$(git describe --always)"
- if [ "$( (git diff --cached ; git diff) | head -n1)" != "" ]
+ if [ "$(git status --porcelain | cut -c1-2 | tr -d ' ?\n')" != "" ]
then
- _status=$_status"-$( (git diff --cached ; git diff) | md5sum | sed 's/^\(.......\).*$/-D1rTY-\1/')"
+ # Dirty
+ return 1
fi
- echo $_status
- else
- echo
fi
+ # Clean
+ return 0
}
__normal_user ()
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 6e10c54..c947d6a 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -329,8 +329,7 @@ __two_lines_prompt ()
}
-ZSH_STATUS=$(__zsh_status)
-if ( echo $ZSH_STATUS | grep -q -- "-D1rTY-" )
+if ( ! __zsh_status )
then
if ( __privileged_user )
then