]> git.wh0rd.org Git - home.git/commitdiff
vcs-url: add more dynamic lookup
authorMike Frysinger <vapier@gentoo.org>
Wed, 1 Feb 2023 16:40:33 +0000 (11:40 -0500)
committerMike Frysinger <vapier@gentoo.org>
Wed, 1 Feb 2023 16:40:33 +0000 (11:40 -0500)
.bin/vcs-url

index 8b05986768b33db107af0abf1bdf8d106d588e74..e743c9ceb1f061956cf0f8a332d65f46dc9172aa 100755 (executable)
@@ -71,6 +71,12 @@ git_url() {
                remote=$(git config "branch.${branch}.remote")
                if [[ -n ${remote} ]] ; then
                        remote=$(git config "remote.${remote}.url")
+               else
+                       # Still try harder.
+                       local remotes=$(git config --get-regexp 'remote\..*\.url')
+                       if [[ -n ${remotes} ]]; then
+                               remote=$(echo "${remotes}" | awk '{print $2; exit}')
+                       fi
                fi
        fi
 
@@ -135,7 +141,7 @@ git_url() {
                url="https://git.kernel.org/${repo}.git/commit/?id="
                ;;
        *)
-               echo "Unknown remote: ${remote}"
+               echo "Unknown remote: '${remote}'"
                exit 1
                ;;
        esac