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

Function test_checkout_head

test/test_repository.py:244–257  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

242
243
244def test_checkout_head(testrepo: Repository) -> None:
245 # some changes to the index
246 with (Path(testrepo.workdir) / 'bye.txt').open('w') as f:
247 f.write('new content')
248 testrepo.index.add('bye.txt')
249
250 # checkout from index should not change anything
251 assert 'bye.txt' in testrepo.status()
252 testrepo.checkout(strategy=CheckoutStrategy.FORCE)
253 assert 'bye.txt' in testrepo.status()
254
255 # checkout from head will reset index as well
256 testrepo.checkout('HEAD', strategy=CheckoutStrategy.FORCE)
257 assert 'bye.txt' not in testrepo.status()
258
259
260def test_checkout_alternative_dir(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 5

openMethod · 0.80
statusMethod · 0.80
checkoutMethod · 0.80
writeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…