Page MenuHomePhabricator

git URI normalization is not reliable
Closed, DuplicatePublic

Description

PhabricatorRepositoryURI::getURIObject() contains the following comment:

// Users can provide Git/SCP-style URIs in the form "user@host:path".
// These are equivalent to "ssh://user@host/path". We use the more standard
// form internally, and convert to it if we need to specify a port number,
// but try to preserve what the user typed when displaying the URI.

However, the user@host and ssh:// url forms are not equivalent--in the user@host form, the path is usually relative to the user's homedir, while in the ssh:// form, the path is relative to root. (This is the behaviour when pulling over a vanilla ssh+shell setup--obviously hosting tools can make their own choices.) The result is that user@host:path repository references break.

This stuff isn't terribly well documented on the git side. The most-relevant documentation seems to be https://git-scm.com/docs/git-push#URLS which doesn't specify exact behaviour. Looking at the url parsing source, in an ssh:// url the / separator is *included* in the path.

Event Timeline

I'm going to merge this into T11137. They don't describe the same issue, but I'm planning to fix them in the same way.