summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2008-02-07 12:19:57 +0100
committerHugues Hiegel <hugues@hiegel.fr>2008-03-07 14:15:20 +0100
commit37c79a74a154088a6cf056f88a12417089376ed2 (patch)
treed46e04c4466df1d1a2915f586fa21217e36d320e
parent59aee076f33ffb2b99b186cb0a250660f62921ce (diff)
Git-status will be better like this.
-rw-r--r--01_Functions.zsh14
-rw-r--r--11_Prompts.zsh8
2 files changed, 13 insertions, 9 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index 14db560..6966f56 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -45,22 +45,24 @@ get_git_branch ()
check_git_status ()
{
## GIT TRACKING ##
- if [ "$GITCHECK" != "" ]
+ if [ "$GITCHECK" != "no" ]
then
GITBRANCH=$(get_git_branch);
if [ "$GITBRANCH" != "" ]
then
preprint "Check git status..."
- _git_status=$(git-status 2>&- | grep -E '^# ([[:alpha:]]+ )+(but not|to be)( [[:alpha:]]+)+:$')
- if [ "$(grep "but not" <<< $_git_status)" != "" ] ; then
- COLOR_GIT=$COLOR_NOT_UP_TODATE
- elif [ "$(grep "to be committed" <<< $_git_status)" != "" ] ; then
- COLOR_GIT=$COLOR_TOBE_COMMITED
+ #_git_status=$(git-status 2>&- | grep -E '^# ([[:alpha:]]+ )+(but not|to be)( [[:alpha:]]+)+:$')
+ if [ "$(git-diff --cached | lsdiff)" != "" ] ; then
+ COLOR_GIT=$COLOR_TO_BE_COMMITED
+ elif [ "$(git-ls-files -m)" != "" ] ; then
+ COLOR_GIT=$COLOR_NOT_UP_TO_DATE
else
COLOR_GIT=$COLOR_BRANCH_OR_REV
fi
fi
+ else
+ GITBRANCH=""
fi
GitBranch=${GITBRANCH:+:$GITBRANCH}
GITBRANCH=${GITBRANCH:+$C_$COLOR_DOUBLEDOT$_C:$C_$COLOR_GIT$_C$GITBRANCH}
diff --git a/11_Prompts.zsh b/11_Prompts.zsh
index 60f5ec8..b680a79 100644
--- a/11_Prompts.zsh
+++ b/11_Prompts.zsh
@@ -44,8 +44,8 @@ COLOR_BAR="0;$GENERIC;$BOLD"
COLOR_BRACES=$COLOR_BAR
COLOR_BRANCH_OR_REV="0;$GENERIC"
-COLOR_NOT_UP_TODATE="0;$GREEN;$BOLD"
-COLOR_TOBE_COMMITED="0;$YELLOW;$BOLD"
+COLOR_NOT_UP_TO_DATE="0;$GREEN;$BOLD"
+COLOR_TO_BE_COMMITED="0;$YELLOW;$BOLD"
COLOR_CMD="$VOID"
COLOR_EXEC="$VOID"
@@ -105,6 +105,8 @@ precmd ()
SVNREV=
fi
+ check_git_status
+
## First line of prompt :
#
# -ERR------------------------git-svn-[ date ]-
@@ -137,12 +139,12 @@ precmd ()
# Mailcheck
[ -s ~/.procmail/procmail.log ] && [ `< ~/.procmail/procmail.log awk 'BEGIN {RS="From" ; HAM=0} !/JUNK/ { HAM++ } END { print HAM }'` -gt 1 ] && sbin/mails | grep -v JUNK
+
}
chpwd()
{
which todo > /dev/null 2>&1 && todo
- check_git_status
}