From 1fcacd340e1558fe5ce94ae2da2f1478524d8ba2 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 2 Jul 2013 16:51:46 -0400 Subject: [PATCH] prompt_ps1_git_branch: fix in case the words "ahead" or "behind" are in the commit comment --- bash_aliases | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_aliases b/bash_aliases index 5a38eef..00806ac 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)' | grep -Eo '(ahead|behind)[^]]*') + ahead_behind=$(echo "$branch_out" | grep -E '(ahead|behind)' | grep -Eo '\[.*\]' | grep -Eo '(ahead|behind)[^]]*') if [[ "$ahead_behind" != "" ]]; then ahead_behind=": ${ahead_behind}" fi