diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2011-06-08 11:27:47 +0200 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2011-06-08 11:27:47 +0200 |
| commit | 74b13c58345d7a8225bbffdfe4d845bb1e703692 (patch) | |
| tree | f1af7353208fb420ef2c8fe883fdf67690f9b656 | |
| parent | ee9d6b97ad7d7bf6761161dc411258f2aa86d8c0 (diff) | |
| download | GitPython-74b13c58345d7a8225bbffdfe4d845bb1e703692.tar.gz GitPython-74b13c58345d7a8225bbffdfe4d845bb1e703692.zip | |
symbolic reference handles different types for comparison more gracefully. Fixed possible issue in test_refs, which occurred in 0.3 previously
| -rw-r--r-- | git/refs/symbolic.py | 4 | ||||
| -rw-r--r-- | git/test/refs/test_refs.py | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index 8c3689b4..ec31f30c 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -64,7 +64,9 @@ class SymbolicReference(object): return '<git.%s "%s">' % (self.__class__.__name__, self.path) def __eq__(self, other): - return self.path == other.path + if hasattr(other, 'path'): + return self.path == other.path + return False def __ne__(self, other): return not ( self == other ) diff --git a/git/test/refs/test_refs.py b/git/test/refs/test_refs.py index e49b23ab..668dd94c 100644 --- a/git/test/refs/test_refs.py +++ b/git/test/refs/test_refs.py @@ -140,7 +140,6 @@ class TestRefs(TestBase): assert len(log) == 1 assert log[0].oldhexsha == pcommit.NULL_HEX_SHA assert log[0].newhexsha == pcommit.hexsha - def test_refs(self): types_found = set() @@ -285,6 +284,15 @@ class TestRefs(TestBase): assert remotes for remote in remotes: refs = remote.refs + + # If a HEAD exists, it must be deleted first. Otherwise it might + # end up pointing to an invalid ref it the ref was deleted before. + remote_head_name = "HEAD" + if remote_head_name in refs: + RemoteReference.delete(rw_repo, refs[remote_head_name]) + del(refs[remote_head_name]) + #END handle HEAD deletion + RemoteReference.delete(rw_repo, *refs) remote_refs_so_far += len(refs) for ref in refs: |
