Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit74b13c5

Browse files
committed
symbolic reference handles different types for comparison more gracefully. Fixed possible issue in test_refs, which occurred in 0.3 previously
1 parentee9d6b9 commit74b13c5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

‎git/refs/symbolic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ def __repr__(self):
6464
return'<git.%s "%s">'% (self.__class__.__name__,self.path)
6565

6666
def__eq__(self,other):
67-
returnself.path==other.path
67+
ifhasattr(other,'path'):
68+
returnself.path==other.path
69+
returnFalse
6870

6971
def__ne__(self,other):
7072
returnnot (self==other )

‎git/test/refs/test_refs.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def test_heads(self, rw_repo):
140140
assertlen(log)==1
141141
assertlog[0].oldhexsha==pcommit.NULL_HEX_SHA
142142
assertlog[0].newhexsha==pcommit.hexsha
143-
144143

145144
deftest_refs(self):
146145
types_found=set()
@@ -285,6 +284,15 @@ def test_head_reset(self, rw_repo):
285284
assertremotes
286285
forremoteinremotes:
287286
refs=remote.refs
287+
288+
# If a HEAD exists, it must be deleted first. Otherwise it might
289+
# end up pointing to an invalid ref it the ref was deleted before.
290+
remote_head_name="HEAD"
291+
ifremote_head_nameinrefs:
292+
RemoteReference.delete(rw_repo,refs[remote_head_name])
293+
del(refs[remote_head_name])
294+
#END handle HEAD deletion
295+
288296
RemoteReference.delete(rw_repo,*refs)
289297
remote_refs_so_far+=len(refs)
290298
forrefinrefs:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp