diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-11-30 11:11:41 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-11-30 11:11:41 +0100 |
commit | bac518bfa621a6d07e3e4d9f9b481863a98db293 (patch) | |
tree | 2a9cd29bef215d8c8e64410585c636a7cb4ca68a /test/git/test_refs.py | |
parent | 4f7255c2c1d9e54fc2f6390ad3e0be504e4099d3 (diff) | |
download | gitpython-bac518bfa621a6d07e3e4d9f9b481863a98db293.tar.gz |
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
Diffstat (limited to 'test/git/test_refs.py')
-rw-r--r-- | test/git/test_refs.py | 14 |
1 files changed, 14 insertions, 0 deletions
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 |