Ahead/Behind only if actually ahead/behind

* Previously status was also displayed, when branch name contained 'ahead' or 'behind'
master
Jakob Erdmann 9 years ago committed by GitHub
parent f399604cb9
commit 6a88806815
  1. 4
      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

Loading…
Cancel
Save