diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-11-30 10:37:05 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-11-30 10:37:05 +0100 |
commit | 4f7255c2c1d9e54fc2f6390ad3e0be504e4099d3 (patch) | |
tree | 6d40b3c9108d0728a047e8cc12632059451f0e01 /test/git/test_refs.py | |
parent | 8775b6417b95865349a59835c673a88a541f3e13 (diff) | |
download | gitpython-4f7255c2c1d9e54fc2f6390ad3e0be504e4099d3.tar.gz |
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
Diffstat (limited to 'test/git/test_refs.py')
-rw-r--r-- | test/git/test_refs.py | 17 |
1 files changed, 17 insertions, 0 deletions
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" |