+indexthemap()
+{
+ REFNAME=$1
+ M=$2
+ blobhash=$3
+ commithash=$4
+ echo "$M $blobhash $commithash $REFNAME"
+}
+
+rundownload()
+{
+ mkdir -p "$bspdir" "$bspdir.old"
+ for b in "$bspdir"/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
+ if [ -e "$b" ]; then
+ mv "$b" "$bspdir.old"/
+ fi
+ done
+ allmaps "HEAD" getthemap "$url_http" "$bspdir.old" "$bspdir"
+}
+
+branches()
+{
+ git for-each-ref 'refs/remotes' | grep -vE ' refs/remotes/([^/]*/HEAD|.*/archived/.*)$'
+}
+
+runmakeindex()
+{
+ cd data/xonotic-maps.pk3dir
+ branches | while read -r HASH TYPE REFNAME; do
+ allmaps "$HASH" indexthemap "$REFNAME"
+ done
+ cd ../..
+}
+