+ case "$location" in
+ current)
+ if [ x"`git config xonotic.all.mirrorselection 2>/dev/null || true`" != x"done" ]; then
+ git config xonotic.all.mirrorselection done
+ location=best
+ fi
+ ;;
+ esac
+ case "$location" in
+ best)
+ # if we fetched via ssh://, switch to git:// for fetching and keep using ssh:// for pushing
+ case "$base" in
+ ssh://*)
+ pushbase=$base
+ base=git://git.xonotic.org/xonotic/
+ ;;
+ esac
+ newbase=`$ECHO "$base" | sed "s,://\(.*\.\)\?git.xonotic.org/,:// .git.xonotic.org/,"`
+ case "$newbase" in
+ *\ *)
+ if location=`bestmirror $newbase"xonotic.git" de us nl:'*6/5'`; then # 20% malus to the NL server to not overload it too much
+ :
+ else
+ location=current
+ fi
+ ;;
+ *)
+ location=current
+ ;;
+ esac
+ ;;
+ esac
+ case "$location" in
+ default)
+ location=
+ ;;
+ current)
+ case "$base" in
+ *://*.git.xonotic.org/*)
+ location=${base%%.git.xonotic.org/*}
+ location=${location##*://}
+ ;;
+ *)
+ location=
+ ;;
+ esac
+ ;;
+ esac
+ if [ -n "$location" ]; then
+ base=`$ECHO "$base" | sed "s,://\(.*\.\)\?git.xonotic.org/,://$location.git.xonotic.org/,"`
+ pushbase=`$ECHO "$pushbase" | sed "s,://\(.*\.\)\?git.xonotic.org/,://$location.git.xonotic.org/,"`
+ else
+ base=`$ECHO "$base" | sed "s,://\(.*\.\)\?git.xonotic.org/,://git.xonotic.org/,"`
+ pushbase=`$ECHO "$pushbase" | sed "s,://\(.*\.\)\?git.xonotic.org/,://git.xonotic.org/,"`
+ fi