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.

Event Timeline

enko created this task.Nov 28 2013, 4:02 PM
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.
enko assigned this task to epriestley.Nov 29 2013, 10:13 AM
chad removed epriestley as the assignee of this task.Nov 29 2013, 3:56 PM
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.

enko added a comment.Nov 29 2013, 6:02 PM

Maybe not anything, but just the repository name 'urlified'?

For example https://bk-dev.hacked.jp/diffusion/DO/ becomes https://bk-dev.hacked.jp/diffusion/DO/dokuwiki-objectrepresentation.git

◀ Merged tasks: T4201.

wotte added a comment.Dec 5 2013, 1:48 AM

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.Jan 28 2014, 11:04 PM
epriestley edited this Maniphest Task.Jan 29 2014, 9:05 PM
epriestley edited this Maniphest Task.Jan 29 2014, 9:46 PM
epriestley edited this Maniphest Task.Jan 29 2014, 10:02 PM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.Jan 30 2014, 5:04 PM
epriestley edited this Maniphest Task.Jan 30 2014, 7:42 PM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley closed this task as Resolved.Jan 30 2014, 7:42 PM

Closed by commit rP3bfa54819e45.