Added support for showing upstream tracking branch in older gitstatus

master
oGre 10 years ago
parent 752701797d
commit a266d2967d
  1. 11
      gitstatus_pre-1.7.10.sh

@ -56,6 +56,7 @@ if (( num_changed == 0 && num_staged == 0 && num_U == 0 && num_untracked == 0 &&
fi fi
remote= remote=
upstream=
if [[ -z "$branch" ]]; then if [[ -z "$branch" ]]; then
tag=`git describe --exact-match` tag=`git describe --exact-match`
@ -81,12 +82,13 @@ else
fi fi
# detect if the local branch have a remote tracking branch # detect if the local branch have a remote tracking branch
cmd_output=$(git rev-parse --abbrev-ref ${branch}@{upstream} 2>&1 >/dev/null) upstream=$( git rev-parse --abbrev-ref ${branch}@{upstream} 2>&1 )
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
has_remote_tracking=1 has_remote_tracking=1
else else
has_remote_tracking=0 has_remote_tracking=0
unset upstream
fi fi
# get the revision list, and count the leading "<" and ">" # get the revision list, and count the leading "<" and ">"
@ -110,9 +112,14 @@ if [[ "$has_remote_tracking" == "0" ]] ; then
remote='_NO_REMOTE_TRACKING_' remote='_NO_REMOTE_TRACKING_'
fi fi
printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \ if [[ -z "$upstream" ]] ; then
remote='.'
fi
printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
"$branch" \ "$branch" \
"$remote" \ "$remote" \
"$upstream" \
$num_staged \ $num_staged \
$num_conflicts \ $num_conflicts \
$num_changed \ $num_changed \

Loading…
Cancel
Save