| 332 | |
| 333 | |
| 334 | def test_submodule_reload(repo: Repository) -> None: |
| 335 | sm = repo.submodules[SUBM_NAME] |
| 336 | assert sm.url == 'https://github.com/libgit2/TestGitRepository' |
| 337 | |
| 338 | # Doctor the config file outside of libgit2 |
| 339 | with open(Path(repo.workdir, '.gitmodules'), 'wt') as f: |
| 340 | f.write('[submodule "TestGitRepository"]\n') |
| 341 | f.write('\tpath = TestGitRepository\n') |
| 342 | f.write('\turl = https://github.com/libgit2/pygit2\n') |
| 343 | |
| 344 | # Submodule object is oblivious to the change |
| 345 | assert sm.url == 'https://github.com/libgit2/TestGitRepository' |
| 346 | |
| 347 | # Tell it to refresh its cache |
| 348 | sm.reload() |
| 349 | assert sm.url == 'https://github.com/libgit2/pygit2' |