Skip to content

Unset or empty remote URL behavior does not match with git CLI #7028

Open
@ehuss

Description

@ehuss

The behavior when a remote's URL is either the empty string, or not set, does not match with the git CLI. If the url is empty or not set, then the CLI uses the remote's name as the URL. I think this is implemented here if you are curious.

Currently, when the url is the empty string, git_remote_url returns NULL. At a minimum, I think it would be good to document that.
If the url is not set, then you get an error loading the remote.

For example, if you have this remote config:

[remote "foo"]
	url =
	fetch = +refs/heads/*:refs/remotes/foo/*

then git_remote_url will return NULL for that remote, whereas git remote get-url foo will print foo, and git fetch foo is also able to fetch from foo if it is a relative path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions