Page MenuHomePhabricator

Add a .git for git repositories
Closed, ResolvedPublic

Description

I don't know if it sounds reasonable, but it would be cool if you could add an alias /diffusion/<callsign>.git for git repositories, as some software require it.

I tried adding this:

diff --git a/src/applications/diffusion/application/PhabricatorApplicationDiffusion.php b/src/applications/diffusion/application/PhabricatorApplicationDiffusion.php
index 9ca2c6a..0677eac 100644
--- a/src/applications/diffusion/application/PhabricatorApplicationDiffusion.php
+++ b/src/applications/diffusion/application/PhabricatorApplicationDiffusion.php
@@ -46,6 +46,7 @@ final class PhabricatorApplicationDiffusion extends PhabricatorApplication {
         'new/' => 'DiffusionRepositoryNewController',
         '(?P<edit>create)/' => 'DiffusionRepositoryCreateController',
         '(?P<edit>import)/' => 'DiffusionRepositoryCreateController',
+       '(?P<callsign>[A-Z]+)\.git/' => 'DiffusionRepositoryDefaultController',
         '(?P<callsign>[A-Z]+)/' => array(
           '' => 'DiffusionRepositoryController',

But that was not so much of a success.

Revisions and Commits

Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

enko raised the priority of this task from to Wishlist.
enko updated the task description. (Show Details)
enko added a project: Diffusion.
enko added a subscriber: enko.
chad added subscribers: epriestley, chad.

A slightly more flexible approach might be:

/diffusion/CALLSIGN/anything.git

...which would let you provide something for "anything" to name the default working copy something human-readable (that is, when you do a clone right now you get "CALLSIGN/", but it would be slightly nicer to clone "/diffusion/CALLSIGN/project.git" and get "project/").

I held off on this initially because I wasn't sure we could do it without breaking stuff, but now that we've implemented things I believe it's possible (albeit somewhat more involved than the one liner above).

One downside is that having unlimited canonical URIs for the project is kind of sketchy. We can hard-code the Phabricator equivalence rules into Phabricator, but we can't reasonably expect other tools to know that "/CALLSIGN/anything.git" is the same for any value of "anything".

packagist's behavior here also seems a bit dumb. If the only motivation in the wild is "packagist is written dumb", maybe a cleaner fix is in the packagist upstream. Or you could work around it by registering git.derp.blarp.com and pointing that at your install as a secondary URI to trick packagist.

It might be nice to be able to specify a canonical "anything.git" that appears in the URL that is presented for the clone.

epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.

Closed by commit rP3bfa54819e45.