View Ticket
Ticket UUID: 74782e5f7cf9c3b3430c1b6debbc57c20fe7f3f8
Title: auto-discovery of a repository from a webpage
Status: Closed Type: Feature_Request
Severity: Cosmetic Priority:
Subsystem: Resolution: Rejected
Last Modified: 2013-01-25 18:52:55
Version Found In:
Description & Comments:
It would be a nice addition if there was a way for a webpage to specify where its source repository was, for example by including a html link element in a webpage - <link rel="fossil-repository" href=""> This way, one could easily get to the source repository even if the site url is not being served by fossil directly.

It wouldn't make sense for this to be built into "clone"; a separate "autoclone" command that fetched the given url and looked for the link reference and then called "clone". This functionality can be achieved with an external 2-line shell script, but that goes against fossil's all-in-one philosophy.

drh added on 2010-03-19 01:06:30:
I do not understand what is being requested here. Please elaborate.

anonymous added on 2010-03-19 02:47:35:
It would not be a stretch to say that this feature request is poorly thought-out, needless bloat, or unnecessary.

The inspiration comes from setting up a self-hosted project on sourceforge. The project homepage is which can be redirected (with php) to some other page. As it stands, I don't think fossil will follow a 301/302 http redirect, so it would do no good to instruct people to "fossil clone". They need to find the explicit url of the repository and use "fossil clone" But wouldn't it be nice if they could just use the home page?

Just following redirects is helpful but not enough - what if the home page is still some plain html page? So instead, if the home page had some indicator on it to allow a program to discover where the source is (similar to rss autodiscovery) then an interested user/developer could clone the repository right from the home page, without needing to track down the link to the actual repository. (I don't know if any other systems have a similar convention, but if such a thing became widespread the search engines could make use of it)

The effect would be roughly the same as the shell command:

$ fossil clone `curl http://app-landing-page | grep '<link rel="fossil-source" '| sed 's/.*href="[^"]"/\1/'`

anonymous added on 2010-03-19 06:48:33:
IMO, it is not a problem of fossil. Use RewriteEngine or whatever else. It would be enough. My Apache .htaccess is like:

# You don't need this part:
<FilesMatch "\.repo$">
  Options +ExecCGI
  AddHandler cgi-script .repo
  RewriteEngine Off

# But you need this (you might want to replace foo.repo with /cgi-bin/foo.cgi):
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^Fossil/\[[a-z0-9]{10}\]
RewriteRule ^(.*) /foo.repo/$1 [L]