summaryrefslogtreecommitdiff
path: root/test/test_refs.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-23 22:47:34 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-23 22:47:34 +0100
commit61f3db7bd07ac2f3c2ff54615c13bf9219289932 (patch)
tree3074927bc62c3b4e1473d24e787836d0dfb3fa21 /test/test_refs.py
parenta21a9f6f13861ddc65671b278e93cf0984adaa30 (diff)
downloadgitpython-61f3db7bd07ac2f3c2ff54615c13bf9219289932.tar.gz
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
Diffstat (limited to 'test/test_refs.py')
-rw-r--r--test/test_refs.py61
1 files changed, 32 insertions, 29 deletions
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):