Skip to content

Fix error on comparing git.Remote - #839

Merged
Byron merged 2 commits into
gitpython-developers:masterfrom
tzing:fix-eq
Sep 28, 2019
Merged

Fix error on comparing git.Remote#839
Byron merged 2 commits into
gitpython-developers:masterfrom
tzing:fix-eq

Conversation

@tzing

@tzingtzing commented Feb 7, 2019

Copy link
Copy Markdown
Contributor

We can't use 'foo' in repo.remotes syntax in current version, but 'foo' in repo.refs works fine.

It raises AttributeError before it runs full name search:

In [2]: r=git.Repo('.')
In [3]: 'origin'inr.remotes---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)
<ipython-input-3-800621fb1c9b>in<module>---->1'origin'inr.remotes~/Projects/GitPython/git/util.pyin__contains__(self, attr)
865def__contains__(self, attr):
866# first try identity match for performance-->867rval=list.__contains__(self, attr)
868ifrval:
869returnrval~/Projects/GitPython/git/remote.pyin__eq__(self, other)
449450def__eq__(self, other):
-->451returnself.name==other.name452453def__ne__(self, other):
AttributeError: 'str'objecthasnoattribute'name'

fix it add type check before it compares name.

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #839 into master will decrease coverage by 0.12%.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #839 +/- ##
==========================================
- Coverage 94.79% 94.67% -0.13% 
==========================================
Files 59 59 Lines 9603 9386 -217 ==========================================
- Hits 9103 8886 -217 
Misses 500 500
Impacted FilesCoverage Δ
git/objects/tree.py59.64% <0%> (-0.93%)⬇️
git/index/util.py90.69% <0%> (-0.61%)⬇️
git/index/typ.py96.82% <0%> (-0.58%)⬇️
git/refs/log.py93.84% <0%> (-0.53%)⬇️
git/objects/base.py95.83% <0%> (-0.33%)⬇️
git/refs/tag.py96.66% <0%> (-0.31%)⬇️
git/test/lib/helper.py91.86% <0%> (-0.28%)⬇️
git/refs/reference.py95.74% <0%> (-0.26%)⬇️
git/objects/commit.py91.59% <0%> (-0.25%)⬇️
git/cmd.py83.83% <0%> (-0.18%)⬇️
... and 26 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 1f66e25...036a531. Read the comment docs.

@ByronByron added this to the v3.0.3 - Bugfixes milestone Sep 28, 2019
@Byron

Copy link
Copy Markdown
Member

My apologies for the late reply - I must have missed this PR :(!
Thanks a lot for your contribution!

@Byron
Byron merged commit 9121f62 into gitpython-developers:masterSep 28, 2019
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

@tzing@codecov-io@Byron