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

Function create_conflict_file

test/test_repository_bare.py:212–223  ·  view source on GitHub ↗
(repo: Repository, branch: Branch, content: str)

Source from the content-addressed store, hash-verified

210
211def test_conflicts_in_bare_repository(barerepo: Repository) -> None:
212 def create_conflict_file(repo: Repository, branch: Branch, content: str) -> Oid:
213 oid = repo.create_blob(content.encode('utf-8'))
214 tb = repo.TreeBuilder()
215 tb.insert('conflict', oid, FileMode.BLOB)
216 tree = tb.write()
217
218 sig = pygit2.Signature('Author', 'author@example.com')
219 commit = repo.create_commit(
220 branch.name, sig, sig, 'Conflict', tree, [branch.target]
221 )
222 assert commit is not None
223 return commit
224
225 head_peeled = barerepo.head.peel()
226 assert isinstance(head_peeled, Commit)

Callers 1

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…