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

Function test_amend_commit_tree

test/test_commit.py:192–212  ·  view source on GitHub ↗
(barerepo: Repository)

Source from the content-addressed store, hash-verified

190
191
192def test_amend_commit_tree(barerepo: Repository) -> None:
193 repo = barerepo
194 commit = repo[COMMIT_SHA_TO_AMEND]
195 assert isinstance(commit, Commit)
196 assert commit.id == repo.head.target
197
198 tree = '967fce8df97cc71722d3c2a5930ef3e6f1d27b12'
199 tree_prefix = tree[:5]
200
201 amended_oid = repo.amend_commit(commit, 'HEAD', tree=tree_prefix)
202 amended_commit = repo[amended_oid]
203 assert isinstance(amended_commit, Commit)
204 assert isinstance(commit, Commit)
205
206 assert repo.head.target == amended_oid
207 assert ObjectType.COMMIT.value == amended_commit.type
208 assert commit.message == amended_commit.message
209 assert commit.author == amended_commit.author
210 assert commit.committer == amended_commit.committer
211 assert commit.tree_id != amended_commit.tree_id
212 assert Oid(hex=tree) == amended_commit.tree_id
213
214
215def test_amend_commit_not_tip_of_branch(barerepo: Repository) -> None:

Callers

nothing calls this directly

Calls 1

amend_commitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…