govanityurls icon indicating copy to clipboard operation
govanityurls copied to clipboard

Allow Git paths to specify a default branch

Open zombiezen opened this issue 7 years ago • 1 comments

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?

zombiezen avatar Jan 29 '18 18:01 zombiezen

LGTM, I don't see any critical problems.

rakyll avatar Jan 30 '18 03:01 rakyll