summaryrefslogtreecommitdiff
path: root/01_Internal.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2013-04-26 14:19:53 +0200
committerHugues Hiegel <hugues.hiegel@qosmos.com>2013-04-26 14:19:53 +0200
commit8e7adae415cbe53d48d35751218834c2479b9f30 (patch)
tree9fea7594799af125224feeb6e78bcd0aaaf4078f /01_Internal.zsh
parent801c5d73736b978fd1eb29168d27afc21f97a161 (diff)
[Git] improvments ...
Diffstat (limited to '01_Internal.zsh')
-rw-r--r--01_Internal.zsh16
1 files changed, 9 insertions, 7 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 ()