summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2008-04-01 16:05:41 +0200
committerHugues Hiegel <hugues@hiegel.fr>2008-04-02 14:56:25 +0200
commit5d6dca3f97bbc6393cc62ca696eec98022de6324 (patch)
tree031912fd508c46d23a9ed3dd32780f44516a0cb4
parenta29f80d7684c725d81e8923d5d680384f7078db7 (diff)
nouvelle colorization des branches GIT..
-rw-r--r--01_Functions.zsh23
-rw-r--r--11_Colors.zsh3
2 files changed, 19 insertions, 7 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index 3d1221d..af6423c 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -83,14 +83,25 @@ get_git_branch ()
# a call to `get_git_branch`
get_git_status ()
{
- local my_git_status
+ local my_git_status cached not_up_to_date managment_folder
- if [ "$(git-rev-parse --git-dir)" == "." ]
- then
- my_git_status="$git_colors[managment_folder]"
- elif [ "$(git-diff --cached 2>&- | grep '^diff ')" != "" ] ; then
+ if [ "$(git-rev-parse --git-dir)" == "." ] ; then
+ echo "$git_colors[managment_folder]"
+ return
+ fi
+
+ if [ "$(git-diff --cached 2>&- | grep '^diff ')" != "" ] ; then
+ cached="yes"
+ fi
+ if [ "$(git-ls-files -m 2>&-)" != "" ] ; then
+ not_up_to_date="yes"
+ fi
+
+ if [ "$cached" != "" -a "$not_up_to_date" != "" ] ; then
+ my_git_status="$git_colors[cached_and_not_up_to_date]"
+ elif [ "$cached" != "" ] ; then
my_git_status="$git_colors[cached]"
- elif [ "$(git-ls-files -m 2>&-)" != "" ] ; then
+ elif [ "$not_up_to_date" != "" ] ; then
my_git_status="$git_colors[not_up_to_date]"
else
my_git_status="$git_colors[up_to_date]"
diff --git a/11_Colors.zsh b/11_Colors.zsh
index ab455ca..28bd0ec 100644
--- a/11_Colors.zsh
+++ b/11_Colors.zsh
@@ -76,7 +76,8 @@ set_prompt_colors ()
git_colors[managment_folder]="$color[red];$color[bold]" # .git/... folder browsing
git_colors[cached]="$prompt_colors[to_be_commited]" # git changes in cache
- git_colors[not_up_to_date]="$prompt_colors[not_up_to_date]" # git changes in working tree
+ git_colors[cached_and_not_up_to_date]="$prompt_colors[not_up_to_date];$color[bold]"
+ git_colors[not_up_to_date]="$prompt_colors[not_up_to_date];$color[normal]" # git changes in working tree
git_colors[up_to_date]="$prompt_colors[up_to_date]" # git up-to-date
}