-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Some git commands support relative path URLs, such as this:
~/tmp/hell/downstream$ git submodule add ../upstream/ submod
Cloning into '/home/josh/tmp/hell/downstream/submod'...
done.
~/tmp/hell/downstream$ cat .gitmodules
[submodule "submod"]
path = submod
url = ../upstream/
The documentation in git help clone and git help fetch does not mention relative URL support, but git help submodule does:
<repository>is the URL of the new submodule’s origin repository.
This may be either an absolute URL, or (if it begins with./or
../), the location relative to the superproject’s default remote
repository (Please note that to specify a repositoryfoo.gitwhich
is located right next to a superprojectbar.git, you’ll have to use
../foo.gitinstead of./foo.git- as one might expect when
following the rules for relative URLs - because the evaluation of
relative URLs in Git is identical to that of relative directories).
Despite the lack of documentation in some commands, git appears to accept relative path URLs in almost all cases. How and whether the relative path is resolved to an absolute path seems to be specific to the command and context.
If git-vendor were to support relative path urls, we'd need to come up with a specification for how it should work. Simply "matching git's behavior" is a little tricky without rigorous documentation from git.