From 6a8880681555921f0fc6b9cc8a462552f9877e5b Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 11 Apr 2017 17:11:35 +0200 Subject: [PATCH 1/2] Ahead/Behind only if actually ahead/behind * Previously status was also displayed, when branch name contained 'ahead' or 'behind' --- gitstatus.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitstatus.sh b/gitstatus.sh index 68ff511..39b258b 100755 --- a/gitstatus.sh +++ b/gitstatus.sh @@ -86,11 +86,11 @@ else IFS="[,]" read -ra remote_fields <<< "${branch_fields[1]}" upstream="${remote_fields[0]}" for remote_field in "${remote_fields[@]}"; do - if [[ "$remote_field" == *ahead* ]]; then + if [[ "$remote_field" == ahead ]]; then num_ahead=${remote_field:6} ahead="_AHEAD_${num_ahead}" fi - if [[ "$remote_field" == *behind* ]]; then + if [[ "$remote_field" == behind ]]; then num_behind=${remote_field:7} behind="_BEHIND_${num_behind# }" fi From 0e3f8d5d100428cdf393779bed722a8071aa30fe Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 14 Apr 2017 14:53:39 +0200 Subject: [PATCH 2/2] Merge pull request #1 from ogr3/behind (cherry picked from 044bc02) Proposed fix for #319 --- gitstatus.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitstatus.sh b/gitstatus.sh index 39b258b..713c5db 100755 --- a/gitstatus.sh +++ b/gitstatus.sh @@ -86,11 +86,11 @@ else IFS="[,]" read -ra remote_fields <<< "${branch_fields[1]}" upstream="${remote_fields[0]}" for remote_field in "${remote_fields[@]}"; do - if [[ "$remote_field" == ahead ]]; then + if [[ "$remote_field" == "ahead "* ]]; then num_ahead=${remote_field:6} ahead="_AHEAD_${num_ahead}" fi - if [[ "$remote_field" == behind ]]; then + if [[ "$remote_field" == "behind "* ]] || [[ "$remote_field" == " behind "* ]]; then num_behind=${remote_field:7} behind="_BEHIND_${num_behind# }" fi