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

Function test_create_branch

test/test_branch.py:181–195  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

179
180
181def test_create_branch(testrepo: Repository) -> None:
182 commit = testrepo[LAST_COMMIT]
183 assert isinstance(commit, Commit)
184 testrepo.create_branch('version1', commit)
185 refs = testrepo.listall_branches()
186 assert 'version1' in refs
187 assert testrepo.lookup_branch('version1').target == LAST_COMMIT
188 assert testrepo.lookup_branch(b'version1').target == LAST_COMMIT
189
190 # try to create existing reference
191 with pytest.raises(ValueError):
192 testrepo.create_branch('version1', commit)
193
194 # try to create existing reference with force
195 assert testrepo.create_branch('version1', commit, True).target == LAST_COMMIT
196
197
198def test_delete(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…