From bac518bfa621a6d07e3e4d9f9b481863a98db293 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 30 Nov 2009 11:11:41 +0100 Subject: Generalized custom reference creation down to SymbolicReference level. 'Reference' implementation now shares all the code from the SymbolicReference base. This implementation allows to create any reference you'd like without requireing git calls --- test/git/test_refs.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/git/test_refs.py') diff --git a/test/git/test_refs.py b/test/git/test_refs.py index 132ec2d9..30c08081 100644 --- a/test/git/test_refs.py +++ b/test/git/test_refs.py @@ -239,6 +239,7 @@ class TestRefs(TestBase): full_ref = 'refs/%s' % partial_ref ref = Reference.create(rw_repo, partial_ref) assert ref.path == full_ref + assert ref.object == rw_repo.head.commit self.failUnlessRaises(OSError, Reference.create, rw_repo, full_ref) Reference.delete(rw_repo, full_ref) @@ -246,10 +247,23 @@ class TestRefs(TestBase): # recreate the reference using a full_ref ref = Reference.create(rw_repo, full_ref) assert ref.path == full_ref + assert ref.object == rw_repo.head.commit # recreate using force ref = Reference.create(rw_repo, partial_ref, 'HEAD~1', force=True) assert ref.path == full_ref + assert ref.object == rw_repo.head.commit.parents[0] + + # create symbolic refs + symref_path = "symrefs/sym" + symref = SymbolicReference.create(rw_repo, symref_path, cur_head.reference) + assert symref.path == symref_path + assert symref.reference == cur_head.reference + + self.failUnlessRaises(OSError, SymbolicReference.create, rw_repo, symref_path, cur_head.reference) + SymbolicReference.delete(rw_repo, symref_path) + # would raise if the symref wouldn't have been deleted + symref = SymbolicReference.create(rw_repo, symref_path, cur_head.reference) # test symbolic references which are not at default locations like HEAD # or FETCH_HEAD - they may also be at spots in refs of course -- cgit v1.2.3