Skip to content

Conversation

@cesarizu
Copy link
Contributor

Running code like 'origin' in git.Repo('path/to/existing/repository').remotes
raises an AttributeError instead of returning a boolean. This commit fixes that
behaviour by catching the error when doing an identity match on IterableList.

Minimum test case with version 2.1.11:

>>>'origin'ingit.Repo('path/to/existing/repository').remotesTraceback (mostrecentcalllast): File"<stdin>", line1, in<module>File"/home/cesar/.local/lib/python3.7/site-packages/git/util.py", line867, in__contains__rval=list.__contains__(self, attr) File"/home/cesar/.local/lib/python3.7/site-packages/git/remote.py", line451, in__eq__returnself.name==other.nameAttributeError: 'str'objecthasnoattribute'name'

Copy link
Member

@ByronByron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a single test fails, and I would trust that it is indeed genuine.
Maybe you have some ideas why that would be.
Thanks for your help!

@cesarizu
Copy link
ContributorAuthor

I just tried that same test on master and I still see the failure. Also, it doesn't touch the IterableList#__contains__ function (modified in this PR) at all, so it seems unrelated. Or am I missing something here?

Running code like `'origin' in git.Repo('path/to/existing/repository').remotes` raises an AttributeError instead of returning a boolean. This commit fixes that behaviour by catching the error when doing an identity match on `IterableList`.
@codecov-io
Copy link

Codecov Report

Merging #862 into master will increase coverage by 1.06%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #862 +/- ## ========================================== + Coverage 93.6% 94.66% +1.06%  ========================================== Files 59 59 Lines 9769 9389 -380 ========================================== - Hits 9144 8888 -256 + Misses 625 501 -124
Impacted FilesCoverage Δ
git/index/util.py90.69% <0%> (-0.61%)⬇️
git/index/typ.py96.82% <0%> (-0.58%)⬇️
git/objects/tag.py81.08% <0%> (-0.5%)⬇️
git/test/test_config.py98.33% <0%> (-0.47%)⬇️
git/objects/tree.py59.64% <0%> (-0.36%)⬇️
git/objects/base.py95.83% <0%> (-0.33%)⬇️
git/refs/tag.py96.66% <0%> (-0.31%)⬇️
git/test/test_remote.py97.54% <0%> (-0.3%)⬇️
git/refs/reference.py95.74% <0%> (-0.26%)⬇️
git/refs/symbolic.py96.11% <0%> (-0.14%)⬇️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e93ffe1...dc050e5. Read the comment docs.

@cesarizu
Copy link
ContributorAuthor

In any case, I've just rebased the branch and it's all green now.

@ByronByron added this to the v2.1.12 - Bugfixes milestone Jul 21, 2019
@ByronByron merged commit bd86c87 into gitpython-developers:masterJul 21, 2019
@Byron
Copy link
Member

Thanks a bunch!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@cesarizu@codecov-io@Byron