Check for local branch needs to be moved so that check for behind/after doesn't override the result

master
oGre 10 years ago
parent b50cc5cb0d
commit 9955edb5c3
  1. 8
      gitstatus.sh

@ -56,10 +56,6 @@ remote=
IFS="." read -ra line <<< "${branch_line/\#\# }" IFS="." read -ra line <<< "${branch_line/\#\# }"
branch="${line[0]}" branch="${line[0]}"
if [[ "${#line[@]}" -eq 1 ]]; then
remote="_NO_REMOTE_TRACKING_"
fi
if [[ -z "$branch" ]]; then if [[ -z "$branch" ]]; then
tag=$( git describe --exact-match ) tag=$( git describe --exact-match )
if [[ -n "$tag" ]]; then if [[ -n "$tag" ]]; then
@ -73,6 +69,9 @@ elif [[ "$branch" == *"Initial commit on"* ]]; then
elif [[ "$branch" == *"no branch"* ]]; then elif [[ "$branch" == *"no branch"* ]]; then
branch="_PREHASH_$( git rev-parse --short HEAD )" branch="_PREHASH_$( git rev-parse --short HEAD )"
else else
if [[ "${#line[@]}" -eq 1 ]]; then
remote="_NO_REMOTE_TRACKING_"
else
IFS="[,]" read -ra remote_line <<< "${line[3]}" IFS="[,]" read -ra remote_line <<< "${line[3]}"
for rline in "${remote_line[@]}"; do for rline in "${remote_line[@]}"; do
if [[ "$rline" == *ahead* ]]; then if [[ "$rline" == *ahead* ]]; then
@ -85,6 +84,7 @@ else
fi fi
done done
remote="${behind}${ahead}" remote="${behind}${ahead}"
fi
fi fi
if [[ -z "$remote" ]] ; then if [[ -z "$remote" ]] ; then

Loading…
Cancel
Save