summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-14 17:39:10 +0300
committerLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-14 17:39:10 +0300
commit69e1021960ab784490d1f7a85f3107c51db2d9de (patch)
treedc986cf3f3ec02f5cb11caa6d6c3a1aab32fdbfc
parentMerge branch 'git' (diff)
downloadgit-prompt-69e1021960ab784490d1f7a85f3107c51db2d9de.tar.gz
git-prompt-69e1021960ab784490d1f7a85f3107c51db2d9de.tar.bz2
git-prompt-69e1021960ab784490d1f7a85f3107c51db2d9de.zip
branch name now extracted from "git status"
-rwxr-xr-xprompt23
1 files changed, 9 insertions, 14 deletions
diff --git a/prompt b/prompt
index 9e1472c..777f98a 100755
--- a/prompt
+++ b/prompt
@@ -229,25 +229,20 @@ PROMPT_COMMAND='
# GIT
if [[ -d .git || -d ../.git || -d ../../.git ]]; then
- ### branch
- branch=`git branch -a |sed -n "s/^* //p"`
-
- ### state
+ ### status
# 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`
- status=`
- 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
- " |
- head -1
+ eval `git status |
+ sed -n "
+ s/^# On branch /branch=/p
+ s/^nothing to commit (working directory clean)/status=clean/p
+ s/^# Untracked files:/status=untracked/p
+ s/^# Changed but not updated:/status=modified/p
+ s/^# Changes to be committed:/status=added/p
+ "
`
### compose local label