summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-10-27 20:18:52 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-10-27 20:19:03 +0200
commit2c0b92e40ece170b59bced0cea752904823e06e7 (patch)
tree6af0b302cf325b99d3133f52c9087a6ddd7c53c0 /test
parent97ab197140b16027975c7465a5e8786e6cc8fea1 (diff)
downloadgitpython-2c0b92e40ece170b59bced0cea752904823e06e7.tar.gz
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
Diffstat (limited to 'test')
-rw-r--r--test/git/test_refs.py11
1 files changed, 10 insertions, 1 deletions
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