summaryrefslogtreecommitdiff
path: root/prompt
diff options
context:
space:
mode:
authorLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-15 13:34:13 +0300
committerLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-15 13:34:13 +0300
commit987b895e6660c3372f5eaf5f0586d2cf7180c247 (patch)
tree166081285619e650c4e3dcf126a93b2d8e0d3dd1 /prompt
parentcolor fix (diff)
downloadgit-prompt-987b895e6660c3372f5eaf5f0586d2cf7180c247.tar.gz
git-prompt-987b895e6660c3372f5eaf5f0586d2cf7180c247.tar.bz2
git-prompt-987b895e6660c3372f5eaf5f0586d2cf7180c247.zip
replace git-name-rev (which was incorrectly showing branch name) with branch+head_tail
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}"