summaryrefslogtreecommitdiff
path: root/test/git/test_refs.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-23 16:07:45 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-23 16:07:45 +0200
commit9b9776e88f7abb59cebac8733c04cccf6eee1c60 (patch)
treef7bc7af48ddb55eafde1d1c91d8014ec595208fa /test/git/test_refs.py
parent1047b41e2e925617474e2e7c9927314f71ce7365 (diff)
downloadgitpython-9b9776e88f7abb59cebac8733c04cccf6eee1c60.tar.gz
Refs can now set the reference they are pointing to in a controlled fashion by writing their ref file directly
Diffstat (limited to 'test/git/test_refs.py')
-rw-r--r--test/git/test_refs.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/git/test_refs.py b/test/git/test_refs.py
index 88e8a21a..696b95c7 100644
--- a/test/git/test_refs.py
+++ b/test/git/test_refs.py
@@ -181,4 +181,20 @@ class TestRefs(TestBase):
self.failUnlessRaises(AssertionError, getattr, remote, 'refs')
# END for each remote
- self.fail("set commit using ref.commit = that")
+ # change where the active head points to
+ if cur_head.is_detached:
+ cur_head.reference = rw_repo.heads[0]
+
+ head = cur_head.reference
+ old_commit = head.commit
+ head.commit = old_commit.parents[0]
+ assert head.commit == old_commit.parents[0]
+ assert head.commit == cur_head.commit
+ head.commit = old_commit
+
+ # setting a non-commit as commit fails, but succeeds as object
+ head_tree = head.commit.tree
+ self.failUnlessRaises(TypeError, setattr, head, 'commit', head_tree)
+ assert head.commit == old_commit # and the ref did not change
+ head.object = head_tree
+ assert head.object == head_tree