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/!!'`)
+ branches=(`git for-each-ref --format="%(refname:lstrip=3)" --points-at=HEAD refs/remotes | sort -u`)
fi
if [ "${#branches[*]}" -eq 0 ]; then