Merge pull request #4 from ogr3/porcelain-no-remote

Check for local branch needs to be moved so that check for behind/aft…
master
pedantic79 10 years ago
commit 589106d420
  1. 32
      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,18 +69,22 @@ 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
IFS="[,]" read -ra remote_line <<< "${line[3]}" if [[ "${#line[@]}" -eq 1 ]]; then
for rline in "${remote_line[@]}"; do remote="_NO_REMOTE_TRACKING_"
if [[ "$rline" == *ahead* ]]; then else
num_ahead=${rline:6} IFS="[,]" read -ra remote_line <<< "${line[3]}"
ahead="_AHEAD_${num_ahead}" for rline in "${remote_line[@]}"; do
fi if [[ "$rline" == *ahead* ]]; then
if [[ "$rline" == *behind* ]]; then num_ahead=${rline:6}
num_behind=${rline:7} ahead="_AHEAD_${num_ahead}"
behind="_BEHIND_${num_behind# }" fi
fi if [[ "$rline" == *behind* ]]; then
done num_behind=${rline:7}
remote="${behind}${ahead}" behind="_BEHIND_${num_behind# }"
fi
done
remote="${behind}${ahead}"
fi
fi fi
if [[ -z "$remote" ]] ; then if [[ -z "$remote" ]] ; then

Loading…
Cancel
Save