Allow Git and Mercurial repositories to be cloned with names in the URI

Summary:
Ref T4175. This allows these URIs to all be valid for Git and Mercurial:

  /diffusion/X/
  /diffusion/X/anything.git
  /diffusion/X/anything/

This mostly already works, it just needed a few tweaks.

Test Plan: Cloned git and hg working copies using HTTP and SSH.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T4175

Differential Revision: https://secure.phabricator.com/D8098
This commit is contained in:
epriestley
2014-01-30 11:42:25 -08:00
parent ffeee37810
commit c41b4cfac0
6 changed files with 63 additions and 12 deletions

View File

@@ -6,6 +6,12 @@ final class DiffusionRepositoryDefaultController extends DiffusionController {
// NOTE: This controller is just here to make sure we call
// willBeginExecution() on any /diffusion/X/ URI, so we can intercept
// `git`, `hg` and `svn` HTTP protocol requests.
return new Aphront404Response();
// If we made it here, it's probably because the user copy-pasted a
// clone URI with "/anything.git" at the end into their web browser.
// Send them to the canonical repository URI.
return id(new AphrontRedirectResponse())
->setURI($this->getDiffusionRequest()->getRepository()->getURI());
}
}