From b9a7e85e0a4a622539b0eaf1255f92f35770c05c Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 2 Jul 2013 16:49:22 -0400 Subject: [PATCH] prompt_ps1_git_branch: handle being both ahead and behind tracking branch --- bash_aliases | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_aliases b/bash_aliases index 266bd24..5a38eef 100755 --- a/bash_aliases +++ b/bash_aliases @@ -43,7 +43,7 @@ function prompt_ps1_git_branch() return fi current_branch=$(echo "$branch_out" | sed -re 's/(.no.branch.|[^ ]*).*/\1/') - ahead_behind=$(echo "$branch_out" | grep -E '(ahead|behind)' | sed -re 's/^.*(ahead|behind)(.[0-9]+).*$/\1\2/') + ahead_behind=$(echo "$branch_out" | grep -E '(ahead|behind)' | grep -Eo '(ahead|behind)[^]]*') if [[ "$ahead_behind" != "" ]]; then ahead_behind=": ${ahead_behind}" fi