diff options
author | Leonid Volnitsky <Leonid@Volnitsky.com> | 2008-06-14 11:59:19 +0300 |
---|---|---|
committer | Leonid Volnitsky <Leonid@Volnitsky.com> | 2008-06-14 17:00:47 +0300 |
commit | 666f002cd085d50c5b4fecec8f21940e26511d7d (patch) | |
tree | cb41fd43447f1000261401ff9181dba28acff83f | |
parent | display git branch if in git dir (diff) | |
download | git-prompt-666f002cd085d50c5b4fecec8f21940e26511d7d.tar.gz git-prompt-666f002cd085d50c5b4fecec8f21940e26511d7d.tar.bz2 git-prompt-666f002cd085d50c5b4fecec8f21940e26511d7d.zip |
git WD status detection added (display still ugly)
-rwxr-xr-x | prompt | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -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'" |