summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-14 11:59:19 +0300
committerLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-14 11:59:19 +0300
commit6bc405aca752cef5e8a3ba3551c5344b0d6f0dff (patch)
treecb41fd43447f1000261401ff9181dba28acff83f
parentdisplay git branch if in git dir (diff)
downloadgit-prompt-6bc405aca752cef5e8a3ba3551c5344b0d6f0dff.tar.gz
git-prompt-6bc405aca752cef5e8a3ba3551c5344b0d6f0dff.tar.bz2
git-prompt-6bc405aca752cef5e8a3ba3551c5344b0d6f0dff.zip
git wd stated detection added (display still ugly)
-rwxr-xr-xprompt31
1 files changed, 27 insertions, 4 deletions
diff --git a/prompt b/prompt
index 4a7b799..9c68d10 100755
--- a/prompt
+++ b/prompt
@@ -254,10 +254,33 @@ PROMPT_COMMAND='
# LOCAL
# GIT
- if [[ -d .git || -d ../.git || -d ../../.git ]]; then
- local=`git branch -a |sed -n "s/^* //p"`
- local=${local+($local)}
- fi
+ if [[ -d .git || -d ../.git || -d ../../.git ]]; then
+
+ ### branch
+ branch=`git branch -a |sed -n "s/^* //p"`
+
+ ### state
+ # clean(blue) nothing to commit (working directory clean)
+ # modified(red) # Changed but not updated:
+ # added(green) # Changes to be committed:
+ # untracked(yellow) # Untracked files:
+
+ status_msg=`git status`
+ state=`
+ git status |
+ sed -n -e "
+ s/nothing to commit (working directory clean)/clean/p
+ s/^# Untracked files:/untracked/p
+ s/^# Changed but not updated:/modified/p
+ s/^# Changes to be committed:/added/p
+ "
+ `
+
+ ### compose local label
+ local=${branch+($branch $state)}
+
+ fi
+ #########################
#PS1="$label$rc'$color_who_where$dir_color'${head:10*(${#PWD}<max)}${PWD:(${#PWD}>max)*(${#PWD}-max):max}> '$colors_reset'"
PS1="$label$rc'$color_who_where$dir_color'\w$local> '$colors_reset'"