From 0725af77afc619cdfbe3cec727187e442cceaf97 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 26 Oct 2009 11:21:59 +0100 Subject: refs.SymoblicRef: implemented direcft setting of the symbolic references commit, which possibly dereferences to the respective head --- test/git/test_refs.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/git/test_refs.py') 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 + -- cgit v1.2.3