From 4f7255c2c1d9e54fc2f6390ad3e0be504e4099d3 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 30 Nov 2009 10:37:05 +0100 Subject: ref: Added general method to create and delete any reference pointing to any object. They are only constrained to be located in the refs/ directory --- test/git/test_refs.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/git/test_refs.py b/test/git/test_refs.py index 606346cf..132ec2d9 100644 --- a/test/git/test_refs.py +++ b/test/git/test_refs.py @@ -234,6 +234,23 @@ class TestRefs(TestBase): self.failUnlessRaises(GitCommandError, far_away_head.checkout) assert active_branch == active_branch.checkout(force=True) + # test reference creation + partial_ref = 'sub/ref' + full_ref = 'refs/%s' % partial_ref + ref = Reference.create(rw_repo, partial_ref) + assert ref.path == full_ref + + self.failUnlessRaises(OSError, Reference.create, rw_repo, full_ref) + Reference.delete(rw_repo, full_ref) + + # recreate the reference using a full_ref + ref = Reference.create(rw_repo, full_ref) + assert ref.path == full_ref + + # recreate using force + ref = Reference.create(rw_repo, partial_ref, 'HEAD~1', force=True) + assert ref.path == full_ref + # test symbolic references which are not at default locations like HEAD # or FETCH_HEAD - they may also be at spots in refs of course symbol_ref_path = "refs/symbol_ref" -- cgit v1.2.1