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

Function test_oneshot_update

test/test_submodule.py:185–202  ·  view source on GitHub ↗
(repo: Repository, depth: int)

Source from the content-addressed store, hash-verified

183@utils.requires_network
184@pytest.mark.parametrize('depth', [0, 1])
185def test_oneshot_update(repo: Repository, depth: int) -> None:
186 status = repo.submodules.status(SUBM_NAME)
187 assert status == (SS.IN_HEAD | SS.IN_INDEX | SS.IN_CONFIG | SS.WD_UNINITIALIZED)
188
189 subrepo_file_path = Path(repo.workdir) / SUBM_PATH / 'master.txt'
190 assert not subrepo_file_path.exists()
191 repo.submodules.update(init=True, depth=depth)
192 assert subrepo_file_path.exists()
193
194 status = repo.submodules.status(SUBM_NAME)
195 assert status == (SS.IN_HEAD | SS.IN_INDEX | SS.IN_CONFIG | SS.IN_WD)
196
197 sm_repo = repo.submodules[SUBM_NAME].open()
198 if depth == 0:
199 sm_repo[SUBM_BOTTOM_SHA] # full history must be available
200 else:
201 with pytest.raises(KeyError):
202 sm_repo[SUBM_BOTTOM_SHA] # shallow clone
203
204
205@utils.requires_network

Callers

nothing calls this directly

Calls 4

statusMethod · 0.80
existsMethod · 0.80
openMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…