summaryrefslogtreecommitdiff
path: root/test/test_repo.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-24 09:37:40 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-24 09:37:40 +0100
commit8dd51f1d63fa5ee704c2bdf4cb607bb6a71817d2 (patch)
tree9a3c15132e7f43f1431570f83c696e4d7d5bea49 /test/test_repo.py
parent7029773512eee5a0bb765b82cfdd90fd5ab34e15 (diff)
downloadgitpython-8dd51f1d63fa5ee704c2bdf4cb607bb6a71817d2.tar.gz
Improved refparse error handling in case of out-of-bound indices
Diffstat (limited to 'test/test_repo.py')
-rw-r--r--test/test_repo.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/test_repo.py b/test/test_repo.py
index 820fed26..95b0750a 100644
--- a/test/test_repo.py
+++ b/test/test_repo.py
@@ -557,12 +557,19 @@ class TestRepo(TestBase):
# uses HEAD.ref by default
assert rev_parse('@{0}') == head.commit
if not head.is_detached:
- assert rev_parse('%s@{0}' % head.ref.name) == head.ref.commit
+ refspec = '%s@{0}' % head.ref.name
+ assert rev_parse(refspec) == head.ref.commit
+ # all additional specs work as well
+ assert rev_parse(refspec+"^{tree}") == head.commit.tree
+ assert rev_parse(refspec+":CHANGES").type == 'blob'
#END operate on non-detached head
# the last position
assert rev_parse('@{1}') != head.commit
+ # position doesn't exist
+ self.failUnlessRaises(BadObject, rev_parse, '@{10000}')
+
# currently, nothing more is supported
self.failUnlessRaises(NotImplementedError, rev_parse, "@{1 week ago}")