Get the branch from the superproject's `.gitmodules`.
declare -a branches
branches=(`git branch --points-at=HEAD | tail -n +2`)
declare -a branches
branches=(`git branch --points-at=HEAD | tail -n +2`)
+
+if [ "${#branches[*]}" -eq 0 ]; then
+ branches=(`git config -f $toplevel/.gitmodules --get submodule.$name.branch`)
+fi
+
if [ "${#branches[*]}" -eq 0 ]; then
branches=(`git branch --points-at=HEAD -r | sed 's!^ *origin/!!'`)
fi
if [ "${#branches[*]}" -eq 0 ]; then
branches=(`git branch --points-at=HEAD -r | sed 's!^ *origin/!!'`)
fi