> > Or perhaps there is a way to avoid the "Invalid request" message? Maybe > > by some (automatic) redirection to the adequate corresponding new > > "cgit" link? > > It certainly would be possible to do a redirection, if one can come up > with a mapping from gitweb queries to cgit queries, which I don't know > if someone has already done... >Apparently, it has been done, (e.g. fedoraproject.org _partially_ did it). I have found: ao2.it/en/blog/2011/05/06/migrate-gitweb-cgit-url-rewrite-rules It mentions similar goals, of maintaining already-posted links as valid. Whether it is appropriate for our case, I don't know. The idea (well, what I would like to see) is that links already pointing to something like: git.zytor.com/?p=syslinux/syslinux.git;a=commit;h=<SOME_COMMIT> would *redirect* to: git.zytor.com/syslinux/syslinux.git/commit/?id=<SOME_COMMIT> for example and among others. Some other _examples_ for automatic *redirection* (and there might be others): From: git.zytor.com/?o=age to: git.zytor.com/?s=idle From: git.zytor.com/?p=users<SOME_USER> to: git.zytor.com/users<SOME_USER> When starting with git.zytor.com : From: ;a=commit to: /commit From: ;a=blob_plain;f=<SOME_FILE> to: /plain/<SOME_FILE> From: ;hb=HEAD to: ?id=HEAD (perhaps this is different with other tags?) From: ;h=<SOME_COMMIT> to: /?id=<SOME_COMMIT> TIA, Ady.
On 06/10/2015 09:28 PM, Ady via Syslinux wrote:> > Apparently, it has been done, (e.g. fedoraproject.org _partially_ did > it). > > I have found: > ao2.it/en/blog/2011/05/06/migrate-gitweb-cgit-url-rewrite-rules > > It mentions similar goals, of maintaining already-posted links as > valid. > > Whether it is appropriate for our case, I don't know. >I did find this, and hacked up a script based on their research... I didn't really feel comfy with their use of mod_rewrite which is pretty much undebuggable and black magic, but used a CGI script instead. It at least currently seems to work well enough that we're not completely horked in terms of existing URLs, but if someone finds a URL that doesn't work, I'll hammer on it. -hpa
(snip)> horked in terms of existing URLs, but if someone finds a URL that > doesn't work, I'll hammer on it.Thank you. Perhaps the following (examples of) redirection links could be improved? In the following pairs of links, the first line is the old (gitweb-caching style) link, and the second line would be the destination of the redirection as it would be expected (at least, IMHO). git.zytor.com/?o=descr git.zytor.com/?s=desc git.zytor.com/?o=owner git.zytor.com/?s=owner git.zytor.com/?o=age git.zytor.com/?s=idle Heads: git.zytor.com/?p=syslinux/syslinux.git;a=heads git.zytor.com/syslinux/syslinux.git/refs/heads The redirection of "shortlog" works as expected: git.zytor.com/?p=syslinux/syslinux.git;a=shortlog git.zytor.com/syslinux/syslinux.git/log but the redirection of a "log" (as in gitweb-caching terminology) should rather redirect to the "expanded log" in cgit (note the "?showmsg=1" flag): git.zytor.com/?p=syslinux/syslinux.git;a=log git.zytor.com/syslinux/syslinux.git/log/?showmsg=1 And similarly: git.zytor.com/?p=syslinux/syslinux.git;a=log;h=refs/tags/syslinux -4.07 git.zytor.com/syslinux/syslinux.git/log/?id=refs/tags/syslinux-4. 07&showmsg=1 Tag examples (note the "a=tag" -> "/tag/" parts of the links, instead of "a=commit" -> "/commit/"): git.zytor.com/?p=syslinux/syslinux.git;a=tags git.zytor.com/syslinux/syslinux.git/refs/tags git.zytor.com/?p=syslinux/syslinux.git;a=tag;h=refs/tags/syslinux -4.07 git.zytor.com/syslinux/syslinux.git/tag/?id=syslinux-4.07 git.zytor.com/syslinux/syslinux.git/tag/?id=a4fcb6d867aadcaf5af8f 87eb1ba96abe2748159 git.zytor.com/syslinux/syslinux.git/tag/?id=syslinux-4.07 Snapshot example: git.zytor.com/?p=syslinux/syslinux.git;a=snapshot;h=61f106ba8a5b2 a7c2d9855291fd9e7f4a4d3143d;sf=tgz Note that in this example, the "sf=" parameter is "sf=tgz". So perhaps it should go to: git.zytor.com/syslinux/syslinux.git/snapshot/syslinux-61f106ba8a5 b2a7c2d9855291fd9e7f4a4d3143d.tar.gz I think that an old "gitweb-chaching" snapshot link should either take the new link format (according to the file format; in the example: "sf=tgz" -> ".tar.gz"), and if it fails (e.g. the file does not exist) it should fallback to the respective commit id. In this example, the fallback (i.e. commit id) would be: git.zytor.com/syslinux/syslinux.git/commit/?id=61f106ba8a5b2a7c2d 9855291fd9e7f4a4d3143d where several file formats would be available as snapshots for download. TIA, Ady.