From c9cf30461956b9f3fa101495cffb375d5f88ec10 Mon Sep 17 00:00:00 2001 From: Leonid Volnitsky Date: Thu, 28 Apr 2011 18:29:21 +0300 Subject: Indicator for when you branch is ahead of origin --- git-prompt.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'git-prompt.sh') 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 } -- cgit v1.2.3