Skip to content

ValueError repo.branches.get('branch_no_exist/') trailing slashes in branch names #832

Open
@Richard-Mathie

Description

@Richard-Mathie

if i have a repo and call

>> 'branch_no_exist' in repo.branches
False

as expected, but

>> 'branch_no_exist/' in repo.branches
Traceback (most recent call last):

  pygit2/repository.py", line 1156, in get
    return self[key]
 pygit2/repository.py", line 1144, in __getitem__
    branch = self._repository.lookup_branch(name, GIT_BRANCH_LOCAL)
ValueError: cannot locate local branch 'branch_no_exist/'

Given branch names Shouldn't end in a slash, but the error is not complaining about this.

should repository.lookup_branch be returning None in this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions