diff options
author | Leonid Volnitsky <Leonid@Volnitsky.com> | 2011-04-28 18:29:21 +0300 |
---|---|---|
committer | Leonid Volnitsky <Leonid@Volnitsky.com> | 2011-04-28 18:39:03 +0300 |
commit | c9cf30461956b9f3fa101495cffb375d5f88ec10 (patch) | |
tree | 3a787807227bfb4dace0812799d29c9e2ff4a7f5 /git-prompt.sh | |
parent | test (diff) | |
download | git-prompt-c9cf30461956b9f3fa101495cffb375d5f88ec10.tar.gz git-prompt-c9cf30461956b9f3fa101495cffb375d5f88ec10.tar.bz2 git-prompt-c9cf30461956b9f3fa101495cffb375d5f88ec10.zip |
Indicator for when you branch is ahead of origin
Diffstat (limited to 'git-prompt.sh')
-rwxr-xr-x | git-prompt.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/git-prompt.sh b/git-prompt.sh index efa26c3..907f058 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -105,7 +105,6 @@ ### if term support colors, then use color prompt, else bold black='\['`tput sgr0; tput setaf 0`'\]' - dim='\['`tput sgr0; tput setaf p1`'\]' # half-bright red='\['`tput sgr0; tput setaf 1`'\]' green='\['`tput sgr0; tput setaf 2`'\]' yellow='\['`tput sgr0; tput setaf 3`'\]' @@ -120,9 +119,11 @@ YELLOW='\['`tput setaf 3; tput bold`'\]' BLUE='\['`tput setaf 4; tput bold`'\]' MAGENTA='\['`tput setaf 5; tput bold`'\]' - CYAN='\['`tput setaf 6; tput bold`'\]' # why 14 doesn't work? + CYAN='\['`tput setaf 6; tput bold`'\]' WHITE='\['`tput setaf 7; tput bold`'\]' + dim='\['`tput sgr0; tput setaf p1`'\]' # half-bright + bw_bold='\['`tput bold`'\]' on='' @@ -415,6 +416,7 @@ parse_git_status() { added_files=() modified_files=() untracked_files=() + freshness="$dim=" unset branch status modified added clean init added mixed untracked op detached # quoting hell @@ -424,6 +426,7 @@ parse_git_status() { s/^# On branch /branch=/p s/^nothing to commi.*/clean=clean/p s/^# Initial commi.*/init=init/p + s/^# Your branch is ahead of .[/[:alnum:]]\+. by [[:digit:]]\+ commit\./freshness=${WHITE}↑/p /^# Changes to be committed:/,/^# [A-Z]/ { s/^# Changes to be committed:/added=added;/p @@ -497,7 +500,7 @@ parse_git_status() { if [[ $rawhex_len -gt 0 ]] ; then rawhex=`git rev-parse HEAD 2>/dev/null` rawhex=${rawhex/HEAD/} - rawhex="$hex_vcs_color=${rawhex:0:$rawhex_len}" + rawhex="$hex_vcs_color${rawhex:0:$rawhex_len}" else rawhex="" fi @@ -526,7 +529,7 @@ parse_git_status() { fi #branch="<$branch>" fi - vcs_info="$branch$rawhex" + vcs_info="$branch$freshness$rawhex" fi } |