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

Function test_reset_mixed

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

Source from the content-addressed store, hash-verified

371
372
373def test_reset_mixed(testrepo: Repository) -> None:
374 ref = '5ebeeebb320790caf276b9fc8b24546d63316533'
375 with (Path(testrepo.workdir) / 'hello.txt').open() as f:
376 lines = f.readlines()
377 assert 'hola mundo\n' in lines
378 assert 'bonjour le monde\n' in lines
379
380 testrepo.reset(ref, ResetMode.MIXED)
381
382 assert testrepo.head.target == ref
383
384 with (Path(testrepo.workdir) / 'hello.txt').open() as f:
385 lines = f.readlines()
386 # mixed reset will not reset the working copy
387 assert 'hola mundo\n' in lines
388 assert 'bonjour le monde\n' in lines
389
390 # mixed reset will set the index to match working copy
391 diff = testrepo.diff(cached=True)
392 assert diff.patch is not None
393 assert 'hola mundo\n' in diff.patch
394 assert 'bonjour le monde\n' in diff.patch
395
396
397def test_stash(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 2

openMethod · 0.80
diffMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…