| 350 | |
| 351 | |
| 352 | def test_reset_soft(testrepo: Repository) -> None: |
| 353 | ref = '5ebeeebb320790caf276b9fc8b24546d63316533' |
| 354 | with (Path(testrepo.workdir) / 'hello.txt').open() as f: |
| 355 | lines = f.readlines() |
| 356 | assert 'hola mundo\n' in lines |
| 357 | assert 'bonjour le monde\n' in lines |
| 358 | |
| 359 | testrepo.reset(ref, ResetMode.SOFT) |
| 360 | assert testrepo.head.target == ref |
| 361 | with (Path(testrepo.workdir) / 'hello.txt').open() as f: |
| 362 | lines = f.readlines() |
| 363 | # Soft reset will not reset the working copy |
| 364 | assert 'hola mundo\n' in lines |
| 365 | assert 'bonjour le monde\n' in lines |
| 366 | |
| 367 | # soft reset will keep changes in the index |
| 368 | diff = testrepo.diff(cached=True) |
| 369 | with pytest.raises(KeyError): |
| 370 | diff[0] |
| 371 | |
| 372 | |
| 373 | def test_reset_mixed(testrepo: Repository) -> None: |