Skip to content

Support for local file system relative path URLs #6

@thejoshwolfe

Description

@thejoshwolfe

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 repository foo.git which
is located right next to a superproject bar.git, you’ll have to use
../foo.git instead 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions