]> git.wh0rd.org - home.git/blobdiff - .bin/vcs-url
vcs-url: more updates
[home.git] / .bin / vcs-url
index ccda748a14eb63023f9cb974aa9bb7f2e5790971..a86f8b7330bc9cab0fac9398072312e49531ec9b 100755 (executable)
@@ -50,7 +50,7 @@ _cvs_url() {
        [[ ${rev2} == "1.1" || ${rev1} == "${rev2}" ]] \
                && urirev="?rev=${rev2}" \
                || urirev="?r1=${rev1}&r2=${rev2}"
-       echo "http://sources.gentoo.org/${cvsroot}/${file}${urirev}"
+       echo "https://sources.gentoo.org/${cvsroot}/${file}${urirev}"
 }
 cvs_url() {
        local f
@@ -60,7 +60,7 @@ cvs_url() {
 }
 
 git_url() {
-       [[ $# -ne 0 ]] && err "no args supported"
+       [[ $# -gt 1 ]] && err "accepted args: <rev>"
 
        local repo url
        local remote=$(git config remote.origin.url)
@@ -70,18 +70,39 @@ git_url() {
        *://buildroot.org/*|*://git.buildroot.org/*|\
        *://buildroot.net/*|*://git.buildroot.net/*)
                repo=$(echo "${remote}" | sed -e 's,^[^:]*://[^/]*/,,' -e 's:[.]git$::')
-               url="https://git.${repo,,}.org/${repo}/commit/?id="
+               url="https://git."
+               case ${repo} in
+               uclibc)    url+="uclibc.org" ;;
+               buildroot) url+="buildroot.org" ;;
+               *)         url+="busybox.net" ;;
+               esac
+               url+="/${repo}/commit/?id="
                ;;
        *://git@git.gentoo.org/*|\
        *://anongit.gentoo.org/*)
                repo=$(echo "${remote}" | sed 's:.*git[.a-z]*.gentoo.org/::')
-               url="http://gitweb.gentoo.org/${repo}/commit/?id="
+               url="https://gitweb.gentoo.org/${repo}/commit/?id="
                ;;
        git@github.com/*|\
        *://github.com/*)
-               repo=$(echo "${remote}" | sed -e 's,^git@github.com/,,' -e 's,^https://github.com/,,' -e 's:[.]git$::')
+               repo=$(echo "${remote}" | sed -e 's,^git@github.com/,,' -e 's,^https://github.com/,,' -e 's,^git://github.com/,,' -e 's:[.]git$::')
                url="https://github.com/${repo}/commit/"
                ;;
+       git://git.sv.gnu.org/*)
+               repo=$(echo "${remote}" | sed -e 's,^git://git.sv.gnu.org/,,' -e 's:[.]git$::')
+               url="http://git.savannah.gnu.org/cgit/${repo}.git/commit/?h="
+               ;;
+       git://git.code.sf.net/p/*)
+               repo=$(echo "${remote}" | sed -r -e 's,git://git.code.sf.net/p/([^/]*)/.*,\1,')
+               url="http://sourceforge.net/p/${repo}/code/ci/"
+               ;;
+       *://sourceware.org/*)
+               repo=$(echo "${remote}" | sed -e 's,.*/,,' -e 's,[.]git$,,')
+               url="https://sourceware.org/git/?p=${repo}.git;a=commit;h="
+               ;;
+       *.googlesource.com/*)
+               url="${remote%.git}/+/"
+               ;;
        *)
                echo "Unknown remote: ${remote}"
                exit 1