diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-23 22:47:34 +0100 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-23 22:47:34 +0100 |
| commit | 61f3db7bd07ac2f3c2ff54615c13bf9219289932 (patch) | |
| tree | 3074927bc62c3b4e1473d24e787836d0dfb3fa21 /test | |
| parent | a21a9f6f13861ddc65671b278e93cf0984adaa30 (diff) | |
| download | gitpython-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')
| -rw-r--r-- | test/test_index.py | 1 | ||||
| -rw-r--r-- | test/test_refs.py | 61 |
2 files changed, 32 insertions, 30 deletions
diff --git a/test/test_index.py b/test/test_index.py index 78a868c7..5d227897 100644 --- a/test/test_index.py +++ b/test/test_index.py @@ -422,7 +422,6 @@ class TestIndex(TestBase): # same index, no parents commit_message = "index without parents" commit_no_parents = index.commit(commit_message, parent_commits=list(), head=True) - assert SymbolicReference(rw_repo, 'ORIG_HEAD').commit == cur_commit assert commit_no_parents.message == commit_message assert len(commit_no_parents.parents) == 0 assert cur_head.commit == commit_no_parents 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): |
