summaryrefslogtreecommitdiff
path: root/prompt
diff options
context:
space:
mode:
authorLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-15 13:37:06 +0300
committerLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-15 13:37:06 +0300
commitc8e0b3e6b48e9754442a15d72abe0b018324a0ae (patch)
tree166081285619e650c4e3dcf126a93b2d8e0d3dd1 /prompt
parentMerge branch 'git' (diff)
parentreplace git-name-rev (which was incorrectly showing branch name) with branch+... (diff)
downloadgit-prompt-c8e0b3e6b48e9754442a15d72abe0b018324a0ae.tar.gz
git-prompt-c8e0b3e6b48e9754442a15d72abe0b018324a0ae.tar.bz2
git-prompt-c8e0b3e6b48e9754442a15d72abe0b018324a0ae.zip
Merge branch 'git'
Diffstat (limited to 'prompt')
-rwxr-xr-xprompt7
1 files changed, 5 insertions, 2 deletions
diff --git a/prompt b/prompt
index 8597f8f..bf492d0 100755
--- a/prompt
+++ b/prompt
@@ -319,8 +319,11 @@ PROMPT_COMMAND='
eval git_color="\${git_$status}"
git_color=${git_color:-$WHITE}
- ### head
+ ### branch
head=`git-name-rev --name-only HEAD 2>/dev/null`
+ head_tail=`echo $head | sed 's/[^^~]*//'` # we cut head to leave only ^~, and reattach to branch name
+ branch=${branch/master/M}$head_tail
+
head_rev=`git-rev-parse HEAD 2>/dev/null`
head_rev=${head_rev/HEAD/}
head_rev=${head_rev:0:6}
@@ -332,7 +335,7 @@ PROMPT_COMMAND='
file_list+="${git_modified_files+$git_modified$git_modified_files }"
file_list+="${git_untracked_files+$git_untracked$git_untracked_files }"
[[ $file_list ]] && file_list=":${file_list}" # ${+ does not works (?)
- tail_local="(${head/master/m} $white$head_rev$git_color${op+ / $op}$git_color${file_list}$git_color)"
+ tail_local="(${branch} $white$head_rev$git_color${op+ / $op}$git_color${file_list}$git_color)"
### fringes (added depended on location)
head_local="${head_local+$git_color $head_local\n}"