From 2c0b92e40ece170b59bced0cea752904823e06e7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 27 Oct 2010 20:18:52 +0200 Subject: cmd: improved error handling and debug printing head.reset: will now handle resets with paths much better, especially in the --mixed case, see http://github.com/Byron/GitPython/issues#issue/2 --- test/git/test_refs.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/git/test_refs.py') diff --git a/test/git/test_refs.py b/test/git/test_refs.py index b73d574b..99a66fc2 100644 --- a/test/git/test_refs.py +++ b/test/git/test_refs.py @@ -89,6 +89,7 @@ class TestRefs(TestBase): @with_rw_repo('0.1.6') def test_head_reset(self, rw_repo): cur_head = rw_repo.head + old_head_commit = cur_head.commit new_head_commit = cur_head.ref.commit.parents[0] cur_head.reset(new_head_commit, index=True) # index only assert cur_head.reference.commit == new_head_commit @@ -98,8 +99,16 @@ class TestRefs(TestBase): cur_head.reset(new_head_commit, index=True, working_tree=True) # index + wt assert cur_head.reference.commit == new_head_commit - # paths + # paths - make sure we have something to do + rw_repo.index.reset(old_head_commit.parents[0]) + cur_head.reset(cur_head, paths = "test") cur_head.reset(new_head_commit, paths = "lib") + # hard resets with paths don't work, its all or nothing + self.failUnlessRaises(GitCommandError, cur_head.reset, new_head_commit, working_tree=True, paths = "lib") + + # we can do a mixed reset, and then checkout from the index though + cur_head.reset(new_head_commit) + rw_repo.index.checkout(["lib"], force=True)# # now that we have a write write repo, change the HEAD reference - its -- cgit v1.2.1