| 88 | |
| 89 | |
| 90 | def test_checkout_ref(testrepo: Repository) -> None: |
| 91 | ref_i18n = testrepo.lookup_reference('refs/heads/i18n') |
| 92 | |
| 93 | # checkout i18n with conflicts and default strategy should |
| 94 | # not be possible |
| 95 | with pytest.raises(pygit2.GitError): |
| 96 | testrepo.checkout(ref_i18n) |
| 97 | |
| 98 | # checkout i18n with GIT_CHECKOUT_FORCE |
| 99 | head_object = testrepo.head |
| 100 | head = testrepo[head_object.target] |
| 101 | assert 'new' not in head.tree |
| 102 | testrepo.checkout(ref_i18n, strategy=CheckoutStrategy.FORCE) |
| 103 | |
| 104 | head_object = testrepo.head |
| 105 | head = testrepo[head_object.target] |
| 106 | assert head.id == ref_i18n.target |
| 107 | assert 'new' in head.tree |
| 108 | assert 'bye.txt' not in testrepo.status() |
| 109 | |
| 110 | |
| 111 | def test_checkout_callbacks(testrepo: Repository) -> None: |