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

Function test_diff_applies_to_workdir

test/test_apply_diff.py:119–133  ·  view source on GitHub ↗
(
    testrepo: Repository, old_content: str, patch_diff: Diff
)

Source from the content-addressed store, hash-verified

117
118
119def test_diff_applies_to_workdir(
120 testrepo: Repository, old_content: str, patch_diff: Diff
121) -> None:
122 # See if patch applies
123 assert testrepo.applies(patch_diff, ApplyLocation.WORKDIR)
124
125 # Ensure it was a dry run
126 assert read_content(testrepo) == old_content
127
128 # Apply patch for real, then ensure it can't be applied again
129 testrepo.apply(patch_diff, ApplyLocation.WORKDIR)
130 assert not testrepo.applies(patch_diff, ApplyLocation.WORKDIR)
131
132 # It can still be applied to the index, though
133 assert testrepo.applies(patch_diff, ApplyLocation.INDEX)
134
135
136def test_diff_applies_to_index(

Callers

nothing calls this directly

Calls 1

read_contentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…