From 61f3db7bd07ac2f3c2ff54615c13bf9219289932 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 23 Nov 2010 22:47:34 +0100 Subject: Removed ORIG_HEAD handling which was downright wrong. ORIG_HEAD gets only set during merge and rebase, and probably everything that changes the ref more drastically. Probably I have to reread that. What needs to be adjusted though is the reflog --- test/test_refs.py | 61 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 29 deletions(-) (limited to 'test/test_refs.py') diff --git a/test/test_refs.py b/test/test_refs.py index c7764d92..0c0caaf2 100644 --- a/test/test_refs.py +++ b/test/test_refs.py @@ -95,35 +95,38 @@ class TestRefs(TestBase): assert head.tracking_branch() is None # END for each head - # verify ORIG_HEAD gets set for detached heads - head = rwrepo.head - orig_head = head.orig_head() - cur_head = head.ref - cur_commit = cur_head.commit - pcommit = cur_head.commit.parents[0].parents[0] - head.ref = pcommit # detach head - assert orig_head.commit == cur_commit - - # even if we set it through its reference - chaning the ref - # will adjust the orig_head, which still points to cur_commit - head.ref = cur_head - assert orig_head.commit == pcommit - assert head.commit == cur_commit == cur_head.commit - - cur_head.commit = pcommit - assert head.commit == pcommit - assert orig_head.commit == cur_commit - - # with automatic dereferencing - head.commit = cur_commit - assert orig_head.commit == pcommit - - # changing branches which are not checked out doesn't affect the ORIG_HEAD - other_head = Head.create(rwrepo, 'mynewhead', pcommit) - assert other_head.commit == pcommit - assert orig_head.commit == pcommit - other_head.commit = pcommit.parents[0] - assert orig_head.commit == pcommit + # verify REFLOG gets altered + if False: + head = rwrepo.head + orig_head = head.orig_head() + cur_head = head.ref + cur_commit = cur_head.commit + pcommit = cur_head.commit.parents[0].parents[0] + head.ref = pcommit # detach head + assert orig_head.commit == cur_commit + + # even if we set it through its reference - chaning the ref + # will adjust the orig_head, which still points to cur_commit + head.ref = cur_head + assert orig_head.commit == pcommit + assert head.commit == cur_commit == cur_head.commit + + cur_head.commit = pcommit + assert head.commit == pcommit + assert orig_head.commit == cur_commit + + # with automatic dereferencing + head.commit = cur_commit + assert orig_head.commit == pcommit + + # changing branches which are not checked out doesn't affect the ORIG_HEAD + other_head = Head.create(rwrepo, 'mynewhead', pcommit) + assert other_head.commit == pcommit + assert orig_head.commit == pcommit + other_head.commit = pcommit.parents[0] + assert orig_head.commit == pcommit + + # TODO: Need changing a ref changes HEAD reflog as well if it pointed to it def test_refs(self): -- cgit v1.2.1