summaryrefslogtreecommitdiff
path: root/test/git/test_refs.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-26 11:21:59 +0100
committerSebastian Thiel <byronimo@gmail.com>2009-10-26 11:21:59 +0100
commit0725af77afc619cdfbe3cec727187e442cceaf97 (patch)
tree6fd8b2816a31d27d661ad9684292472c67bff6ec /test/git/test_refs.py
parent9dfd6bcca5499e1cd472c092bc58426e9b72cccc (diff)
downloadgitpython-0725af77afc619cdfbe3cec727187e442cceaf97.tar.gz
refs.SymoblicRef: implemented direcft setting of the symbolic references commit, which possibly dereferences to the respective head
Diffstat (limited to 'test/git/test_refs.py')
-rw-r--r--test/git/test_refs.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/git/test_refs.py b/test/git/test_refs.py
index 696b95c7..979165ef 100644
--- a/test/git/test_refs.py
+++ b/test/git/test_refs.py
@@ -198,3 +198,21 @@ class TestRefs(TestBase):
assert head.commit == old_commit # and the ref did not change
head.object = head_tree
assert head.object == head_tree
+ self.failUnlessRaises(TypeError, getattr, head, 'commit') # object is a tree, not a commit
+
+ # set the commit directly using the head. This would never detach the head
+ assert not cur_head.is_detached
+ head.object = old_commit
+ cur_head.reference = head.commit
+ assert cur_head.is_detached
+ parent_commit = head.commit.parents[0]
+ assert cur_head.is_detached
+ cur_head.commit = parent_commit
+ assert cur_head.is_detached and cur_head.commit == parent_commit
+
+ cur_head.reference = head
+ assert not cur_head.is_detached
+ cur_head.commit = parent_commit
+ assert not cur_head.is_detached
+ assert head.commit == parent_commit
+