MCPcopy Create free account
hub / github.com/libgit2/pygit2 / test_refs_create

Function test_refs_create

test/test_refs.py:225–244  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

223
224
225def test_refs_create(testrepo: Repository) -> None:
226 # We add a tag as a new reference that points to "origin/master"
227 reference: Reference | None = testrepo.references.create(
228 'refs/tags/version1', LAST_COMMIT
229 )
230 refs = testrepo.references
231 assert 'refs/tags/version1' in refs
232 reference = testrepo.references.get('refs/tags/version1')
233 assert reference is not None
234 assert reference.target == LAST_COMMIT
235
236 # try to create existing reference
237 with pytest.raises(ValueError):
238 testrepo.references.create('refs/tags/version1', LAST_COMMIT)
239
240 # try to create existing reference with force
241 reference = testrepo.references.create(
242 'refs/tags/version1', LAST_COMMIT, force=True
243 )
244 assert reference.target == LAST_COMMIT
245
246
247def test_refs_create_symbolic(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 2

createMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…