On Sat, Jan 11, 2020 at 12:28:01PM +0100, Jakub Jelinek wrote: > For the redirectors, it could be something like following patch, except the > last new redirect would need also a yet to be written cgi script that would > git undescr the argument and print > Location: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=... > > --- /etc/httpd/conf.d/sourceware-vhost-gcc.include 2019-11-21 > 19:25:03.172399228 +0000 > +++ /etc/httpd/conf.d/sourceware-vhost-gcc.include 2020-01-11 > 11:22:00.752261787 +0000 > @@ -59,6 +59,11 @@ > # Support short URLs for referring to SVN revisions. > RedirectMatch ^/r([0-9]+)$ > https://gcc.gnu.org/viewcvs/gcc?view=revision\&revision=$1 > > + # Similarly for GIT commits. > + RedirectMatch ^/g:([0-9a-zA-Z._{}~^-]+)$ > https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=$1 > + RedirectMatch ^/r[0-9]+-[0-9]+-g([0-9a-f]+)$ > https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=$1 > + RedirectMatch ^/(r[0-9]+-[0-9]+)$ > https://gcc.gnu.org/cgi-bin/gcc-gitref.cgi?r=$1 > + > # ViewCVS setup > > RewriteRule ^/cgi-bin/cvsweb.cgi https://gcc.gnu.org/viewvc/gcc [L] >
And the cgi script could be something like (after the basepoints tags would be pushed to upstream) attached, tested by hand against my copy of the converted repo with: $ git tag -l | grep basepoints basepoints/gcc-0 basepoints/gcc-10 basepoints/gcc-5 basepoints/gcc-6 basepoints/gcc-7 basepoints/gcc-8 basepoints/gcc-9 $ for i in 0 `seq 5 10`; do echo -n basepoints/gcc-$i" "; git log basepoints/gcc-$i --max-count=1 | head -n 1; done basepoints/gcc-0 commit 6f39d4ff6715973bbdf6510a69fccc46f9a746b9 basepoints/gcc-5 commit 89eb97de15f1618bd63b6138e8a5536b935861e8 basepoints/gcc-6 commit 1a46d358050cf6964df0d8ceaffafd0cc88539b2 basepoints/gcc-7 commit 70f4fdeb67fe065041a52304bb20f6ce701b1cf7 basepoints/gcc-8 commit aa90195aedfa348284c6e4e8ce59dc1b734f1d71 basepoints/gcc-9 commit 3bedd3463137d0712b72d582836a0b14c74ef620 basepoints/gcc-10 commit 68ec60c4a377b532ec2d265ea542107c36b1d15c Jakub
#!/bin/sh rel=`echo "$@" | sed -n 's/^r=r\([0-9]\+\)-[0-9]\+$/\1/p'` cnt=`echo "$@" | sed -n 's/^r=r[0-9]\+-\([0-9]\+\)$/\1/p'` repo=/sourceware/git/gcc.git ret= if [ -n "$rel" ]; then if [ -f /opt/rh/git19/enable ]; then . /opt/rh/git19/enable fi sha=`git --git-dir=$repo rev-parse --verify --quiet releases/gcc-$rel` if [ -z "$sha" ]; then sha=`git --git-dir=$repo rev-parse --verify --quiet master` fi if [ -n "$sha" ]; then num=`git --git-dir=$repo describe --all --match basepoints/gcc-$rel $sha 2>/dev/null \ | sed -n 's,^tags/basepoints/gcc-[0-9]\+-\([0-9]\+\)-g[0-9a-f]*$,\1,p;s,^tags/basepoints/gcc-[0-9]\+$,0,p'` if [ -n "$num" ]; then num=`expr $num - $cnt` ret=`git --git-dir=$repo rev-parse --verify $sha~$num` fi fi fi if expr match "$ret" "[0-9a-f]\{7,40\}" > /dev/null; then echo 'Content-type: text/html' echo echo '<html>' echo '<meta http-equiv="Refresh" content="1; url=https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h='$ret'">' echo '</html>' else echo 'Status: 400 Bad Request' echo 'Content-type: text/html' echo echo '<html>' echo '<head><title>400 Bad Request</title></head>' echo '<body>' echo '<h1>Error</h1>' echo '<p>Invalid argument or could not determine git revision.</p>' echo '</body>' echo '</html>' fi