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

Function test_diff_applies_to_index

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

Source from the content-addressed store, hash-verified

134
135
136def test_diff_applies_to_index(
137 testrepo: Repository, old_content: str, patch_diff: Diff
138) -> None:
139 # See if patch applies
140 assert testrepo.applies(patch_diff, ApplyLocation.INDEX)
141
142 # Ensure it was a dry run
143 assert read_content(testrepo) == old_content
144
145 # Apply patch for real, then ensure it can't be applied again
146 testrepo.apply(patch_diff, ApplyLocation.INDEX)
147 assert not testrepo.applies(patch_diff, ApplyLocation.INDEX)
148
149 # It can still be applied to the workdir, though
150 assert testrepo.applies(patch_diff, ApplyLocation.WORKDIR)
151
152
153def test_diff_applies_to_both(

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…