]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/all/git.subr
Moved MAKEFLAGS out of DLL script
[xonotic/xonotic.git] / misc / tools / all / git.subr
index f7923285903bc3673364216280ae82b950325d0c..7d819456f3740c9de03404058bf97cf6e1691f07 100644 (file)
@@ -56,15 +56,15 @@ mirrorspeed()
        # first result is to be ignored, but we use it to check status
        git ls-remote "$1" refs/heads/master >/dev/null 2>&1 || return 1
        # if we can't time, we only check availability
-       if ! { time -p sh -c 'true'; } >/dev/null 2>&1; then
+       if ! $have_time; then
                echo 0
                return
        fi
        # now actually time it
        (
                set +x
-               export REPO=$1 # so that the sh -c subshell can use it
-               { time -p sh -c 'git ls-remote "$REPO" refs/heads/master >/dev/null 2>&1'; } 2>&1 >/dev/null | head -n 1 | cut -d ' ' -f 2 | tr -d . | sed 's,^0*,,' | grep . || echo 0
+               export REPO="$1" # so that the sh -c subshell can use it
+               { measure_time sh -c 'git ls-remote "$REPO" refs/heads/master >/dev/null 2>&1'; } 2>&1 >/dev/null | head -n 1 | cut -d ' ' -f 2 | tr -d . | sed 's,^0*,,' | grep . || echo 0
                        # unit: clock ticks (depends on what "time" returns
        )
 }
@@ -452,16 +452,34 @@ case "$cmd" in
                allrepos ifrepoenabled 0 fix_config_
                ;;
        keygen)
-               if [ -f ~/.ssh/id_rsa.pub ]; then
+               if [ -f ~/.ssh/id_ef25519.pub ]; then
                        msg ""
                        msg "A key already exists and no new one will be generated. If you"
                        msg "already have done the procedure for getting your key approved, you"
                        msg "can skip the following paragraph and already use the repository."
                        msg ""
                        msg "To get access, your key has to be approved first. For that, visit"
-                       msg "$devsite_url, then log in, create a \"New Issue\" on"
-                       msg "the \"Support\" tracker in the \"Repository\" category where you"
-                       msg "apply for access and paste the following output into the issue:"
+                       msg "$gitsite_url, then log in, enter the"
+                       msg "\"xonotic\" project, create an \"Issue\" tagged \"Repository Access\""
+                       msg "to apply for access."
+                       msg ""
+                       msg "After that, go to your profile settings, \"SSH Keys\", \"Add SSH Key\""
+                       msg "and paste the following output:"
+                       msg ""
+                       msg "`cat ~/.ssh/id_ef25519.pub`"
+               elif [ -f ~/.ssh/id_rsa.pub ]; then
+                       msg ""
+                       msg "A key already exists and no new one will be generated. If you"
+                       msg "already have done the procedure for getting your key approved, you"
+                       msg "can skip the following paragraph and already use the repository."
+                       msg ""
+                       msg "To get access, your key has to be approved first. For that, visit"
+                       msg "$gitsite_url, then log in, enter the"
+                       msg "\"xonotic\" project, create an \"Issue\" tagged \"Repository Access\""
+                       msg "to apply for access."
+                       msg ""
+                       msg "After that, go to your profile settings, \"SSH Keys\", \"Add SSH Key\""
+                       msg "and paste the following output:"
                        msg ""
                        msg "`cat ~/.ssh/id_rsa.pub`"
                elif [ -f ~/.ssh/id_dsa.pub ]; then
@@ -471,9 +489,12 @@ case "$cmd" in
                        msg "can skip the following paragraph and already use the repository."
                        msg ""
                        msg "To get access, your key has to be approved first. For that, visit"
-                       msg "$devsite_url, then log in, create a \"New Issue\" on"
-                       msg "the \"Support\" tracker in the \"Repository\" category where you"
-                       msg "apply for access and paste the following output into the issue:"
+                       msg "$gitsite_url, then log in, enter the"
+                       msg "\"xonotic\" project, create an \"Issue\" tagged \"Repository Access\""
+                       msg "to apply for access."
+                       msg ""
+                       msg "After that, go to your profile settings, \"SSH Keys\", \"Add SSH Key\""
+                       msg "and paste the following output:"
                        msg ""
                        msg "`cat ~/.ssh/id_dsa.pub`"
                else
@@ -486,9 +507,12 @@ case "$cmd" in
                        ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa
                        msg ""
                        msg "To get access, your key has to be approved first. For that, visit"
-                       msg "$devsite_url, then log in, create a \"New Issue\" on"
-                       msg "the \"Support\" tracker in the \"Repository\" category where you"
-                       msg "apply for access and paste the following output into the issue:"
+                       msg "$gitsite_url, then log in, enter the"
+                       msg "\"xonotic\" project, create an \"Issue\" tagged \"Repository Access\""
+                       msg "to apply for access."
+                       msg ""
+                       msg "After that, go to your profile settings, \"SSH Keys\", \"Add SSH Key\""
+                       msg "and paste the following output:"
                        msg ""
                        msg "`cat ~/.ssh/id_rsa.pub`"
                fi
@@ -568,7 +592,7 @@ case "$cmd" in
                        fi
                        shift
                done
-               
+
                if $need_bestmirror; then
                        newbase=`bestmirror "$base" "$newprotocol" "$newlocation"`
                        if [ -z "$newbase" ]; then
@@ -648,13 +672,10 @@ case "$cmd" in
                                fi
                                o=`git config xonotic.all.mirrorselection 2>/dev/null || true`
                                git config xonotic.all.mirrorselection try_same
-                               verbose git clone "$url" "$d0/$d"
+                               verbose git clone --branch "$branch" "$url" "$d0/$d"
                                git config xonotic.all.mirrorselection "$o"
                                enter "$d0/$d" verbose
                                fix_git_config "$url" "$pushurl"
-                               if [ "$branch" != "master" ]; then
-                                       verbose git checkout --track -b "$branch" origin/"$branch"
-                               fi
                                cd "$d0"
                        fi
                }
@@ -698,8 +719,10 @@ case "$cmd" in
                        else
                                b=$branch
                                if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
+                                       [ -n "$b" ] || exists=true
                                        verbose git checkout $checkoutflags "$b"
                                elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
+                                       [ -n "$b" ] || exists=true
                                        verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
                                else
                                        $ECHO "WTF? Not even branch $b doesn't exist in $d"