Unset or empty remote URL behavior does not match with git CLI
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 10.6k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the referenced Git remote.c implementation and libgit2's git_remote_url entry point, comparing empty and unset URL handling with the git CLI examples in the issue. Check existing remote-related tests and documentation, then clarify whether the expected result is matching the CLI behavior or documenting the current NULL/error behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100