Permalink
Browse files

Indicator for when you branch is ahead of origin

  • Loading branch information...
1 parent 7fceeab commit c9cf30461956b9f3fa101495cffb375d5f88ec10 @lvv committed Apr 28, 2011
Showing with 8 additions and 4 deletions.
  1. +1 −0 git-prompt.conf
  2. +7 −4 git-prompt.sh
View
@@ -62,6 +62,7 @@
# prompt_char='>'
# root_prompt_char='>'
## prompt_char='$'
+## prompt_char='➔'
## root_prompt_char='#'
##### Per host color
View
@@ -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
}

0 comments on commit c9cf304

Please sign in to comment.