summaryrefslogtreecommitdiff
path: root/test/git/test_refs.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-12-04 10:15:41 +0100
committerSebastian Thiel <byronimo@gmail.com>2009-12-04 10:15:41 +0100
commit8e29a91324ca7086b948a9e3a4dbcbb2254a24a7 (patch)
tree8b41d0d5d44652a45dd056766cca7ea005b1a830 /test/git/test_refs.py
parente4ed59a86909b142ede105dd9262915c0e2993ac (diff)
downloadgitpython-8e29a91324ca7086b948a9e3a4dbcbb2254a24a7.tar.gz
refs: Fixed incorrect retrieval of symbolic reference types - previously we only really knew heads, now we know references as a common base. The adjustment make the ref system as flexible as it was originally meant to be
Diffstat (limited to 'test/git/test_refs.py')
-rw-r--r--test/git/test_refs.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/git/test_refs.py b/test/git/test_refs.py
index 97617c1b..544a1b8c 100644
--- a/test/git/test_refs.py
+++ b/test/git/test_refs.py
@@ -89,20 +89,28 @@ class TestRefs(TestBase):
for head in heads:
cur_head.reference = head
assert cur_head.reference == head
+ assert isinstance(cur_head.reference, Head)
assert cur_head.commit == head.commit
assert not cur_head.is_detached
# END for each head
# detach
- cur_head.reference = heads[0].commit
- assert cur_head.commit == heads[0].commit
+ active_head = heads[0]
+ curhead_commit = active_head.commit
+ cur_head.reference = curhead_commit
+ assert cur_head.commit == curhead_commit
assert cur_head.is_detached
self.failUnlessRaises(TypeError, getattr, cur_head, "reference")
+ # tags are references, hence we can point to them
some_tag = rw_repo.tags[0]
cur_head.reference = some_tag
- assert cur_head.is_detached
+ assert not cur_head.is_detached
assert cur_head.commit == some_tag.commit
+ assert isinstance(cur_head.reference, TagReference)
+
+ # put HEAD back to a real head, otherwise everything else fails
+ cur_head.reference = active_head
# type check
self.failUnlessRaises(ValueError, setattr, cur_head, "reference", "that")