From 489a2eee3d04a2149f1b804d16d48469e9876d73 Mon Sep 17 00:00:00 2001 From: Tej Chajed Date: Fri, 26 Jun 2015 11:01:02 -0400 Subject: [PATCH] Fix ahead printing when both ahead and behind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specifically, the awk parsing bails out early if we're ahead, even though there may be later behind commits, resulting in a status of just "+" when "±" would be correct. --- fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index e252f90..c804adf 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -127,7 +127,7 @@ function __bobthefish_git_ahead -d 'Print the ahead/behind state for the current return end - command git rev-list --left-right '@{upstream}...HEAD' ^/dev/null | awk '/>/ {a += 1} / 0) nextfile} END {if (a > 0 && b > 0) print "±"; else if (a > 0) print "+"; else if (b > 0) print "-"}' + command git rev-list --left-right '@{upstream}...HEAD' ^/dev/null | awk '/>/ {a += 1} / 0 && b > 0) nextfile} END {if (a > 0 && b > 0) print "±"; else if (a > 0) print "+"; else if (b > 0) print "-"}' end function __bobthefish_git_ahead_verbose -d 'Print a more verbose ahead/behind state for the current branch'