Skip to content

reference object equality #860

Closed
Closed
@imbuedhope

Description

@imbuedhope

Similar to #852

References don't seem to have any sense of equality so the following happens

>>> import pygit2
>>> repo = pygit2.Repository('.')
>>> repo.references['refs/heads/master'] == repo.references['refs/heads/master']
False

This breaks container operations with Reference objects.

Unlike objects, references are not necessarily immutable since they can be force pushed to point to a different target.

Implementing __eq__ to be based on Reference.name makes the most sense, I think. __hash__ support does not make sense since references are mutable.

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