8000 equality test for trees is misleading · Issue #580 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content
equality test for trees is misleading #580
Closed
@ctismer

Description

@ctismer

Tree objects inherit the eq methods from BaseCommit,
which is only respecting the sha.

I think that is a design error. When a tree is made recursive by

  tree2 = tree.recurse()

then tree2 is very different if there are subfolders.
But comparison still claims tree == tree2, because the tree sha stays the same (from the top tree).

I propose to fix that for at least this case or remove it completely. Instead, let equality really compare
the structures. Equality on the sha values is tested better explicit than implicit.

As a workaround, tree.as_dict() == tree2.as_dict() works correctly. But that was very confusing
until I found the simple reason.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0