MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / test_clone_with_recursive_submodules

Function test_clone_with_recursive_submodules

tests/store_test.py:322–343  ·  view source on GitHub ↗
(store, tmp_path)

Source from the content-addressed store, hash-verified

320
321
322def test_clone_with_recursive_submodules(store, tmp_path):
323 sub = tmp_path.joinpath('sub')
324 sub.mkdir()
325 sub.joinpath('submodule').write_text('i am a submodule')
326 cmd_output('git', '-C', str(sub), 'init', '.')
327 cmd_output('git', '-C', str(sub), 'add', '.')
328 git.commit(str(sub))
329
330 repo = tmp_path.joinpath('repo')
331 repo.mkdir()
332 repo.joinpath('repository').write_text('i am a repo')
333 cmd_output('git', '-C', str(repo), 'init', '.')
334 cmd_output('git', '-C', str(repo), 'add', '.')
335 cmd_output('git', '-C', str(repo), 'submodule', 'add', str(sub), 'sub')
336 git.commit(str(repo))
337
338 rev = git.head_rev(str(repo))
339 ret = store.clone(str(repo), rev)
340
341 assert os.path.exists(ret)
342 assert os.path.exists(os.path.join(ret, str(repo), 'repository'))
343 assert os.path.exists(os.path.join(ret, str(sub), 'submodule'))

Callers

nothing calls this directly

Calls 3

cmd_outputFunction · 0.90
cloneMethod · 0.80
existsMethod · 0.80

Tested by

no test coverage detected