branch upstream_name InvalidRefSpec error on literal remote values for branch
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 408
- Avg merge
- 2d 57m
- Merged PRs (30d)
- 7
Description
when using hub (https://hub.github.com) to checkout pull requests, it generates a config entry for the branch with the direct reference to the remote git url instead of adding in a remote. This seems to cause some confusion for pygit, specifically iy will end up throwing an InvalidSpecError as pygit tries to follow the remote as a name instead of being to handle a literal git repo value. I'd suggest in such a case pygit simply return the remote name.
https://github.com/libgit2/pygit2/blob/master/src/branch.c#L245
$ branch
<_pygit2.Branch object at 0x10d1197b0>
$ branch.upstream_name
*** _pygit2.InvalidSpecError: 'https://github.com/steveparker-1984/cloud-custodian.git' is not a valid remote name.
entry in .git/config
[branch "fail-on-assume-role-error"]
remote = https://github.com/steveparker-1984/cloud-custodian.git
merge = refs/heads/fail-on-assume-role-error
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 by inspecting src/branch.c around line 245 and reproduce the shown configuration with a literal HTTPS value in branch.remote. Trace branch.upstream_name handling for that value; done means it no longer raises InvalidSpecError and follows the requested remote-name behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100