Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch.remote_name always seems to return a ValueError #1045

Closed
dcbaker opened this issue Nov 2, 2020 · 4 comments
Closed

Branch.remote_name always seems to return a ValueError #1045

dcbaker opened this issue Nov 2, 2020 · 4 comments

Comments

@dcbaker
Copy link

dcbaker commented Nov 2, 2020

I can reproduce this with both 1.2.1 and 1.3.0, using python 3.8 and libgit2 1.0.1

(Pdb) p branch.remote_name
*** ValueError: reference 'refs/heads/master' is not a remote branch.
@jdavid
Copy link
Member

jdavid commented Nov 3, 2020

The error message says it: is not a remote branch.

@jdavid jdavid closed this as completed Nov 3, 2020
@dcbaker
Copy link
Author

dcbaker commented Nov 3, 2020

Then this is a documentation issue, it's documented as:

remote_name

    The name of the remote set to be the upstream of this branch.

sure sounds like this should return the name of the remote that contains the upstream branch, ie, f{branch.remote_name}/{branch.upstream_name} would be origin/master in this case.

jdavid added a commit that referenced this issue Nov 4, 2020
@jdavid
Copy link
Member

jdavid commented Nov 4, 2020

Oh that's true, here we just wrap git_branch_remote_name, see https://libgit2.org/libgit2/#HEAD/group/branch/git_branch_remote_name

In commit d13fd3b I've fixed the doc string.

@jdavid
Copy link
Member

jdavid commented Nov 4, 2020

What you're looking for is branch.upstream_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants