govanityurls
govanityurls copied to clipboard
Allow Git paths to specify a default branch
I'd like to add support for having paths correspond with a particular branch of a repository. This would enable, for instance, a custom import path to allow gopkg.in-style versioning. A hypothetical example:
host: example.com
paths:
/foo:
repo: https://github.com/example/foo
/foo.v2:
repo: https://github.com/example/foo
branch: v2
and then gradually the branches could be swapped:
host: example.com
paths:
/foo:
repo: https://github.com/example/foo
branch: v1
/foo.v2:
repo: https://github.com/example/foo
I propose taking the approach used by gopkg.in: point the source URL to a dummy URL on the govanityurls server, rewrite the refs response, then HTTP 301 over to the real Git repository.
I think a similar approach could be added for Mercurial later, but I'd rather focus on Git right now.
@rakyll WDYT?
LGTM, I don't see any critical problems.