summaryrefslogtreecommitdiff
path: root/prompt
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 17:00:47 +0300
commit666f002cd085d50c5b4fecec8f21940e26511d7d (patch)
treecb41fd43447f1000261401ff9181dba28acff83f /prompt
parentdisplay git branch if in git dir (diff)
downloadgit-prompt-666f002cd085d50c5b4fecec8f21940e26511d7d.tar.gz
git-prompt-666f002cd085d50c5b4fecec8f21940e26511d7d.tar.bz2
git-prompt-666f002cd085d50c5b4fecec8f21940e26511d7d.zip
git WD status detection added (display still ugly)
Diffstat (limited to 'prompt')
-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'"