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

Function test_clone_repository_and_remote_callbacks

test/test_repository.py:749–768  ·  view source on GitHub ↗
(
    barerepo: Repository, tmp_path: Path
)

Source from the content-addressed store, hash-verified

747
748
749def test_clone_repository_and_remote_callbacks(
750 barerepo: Repository, tmp_path: Path
751) -> None:
752 url = Path(barerepo.path).resolve().as_uri()
753 repo_path = tmp_path / 'clone-into'
754
755 def create_repository(path: Path, bare: bool) -> Repository:
756 return init_repository(path, bare)
757
758 # here we override the name
759 def create_remote(repo: Repository, name: str, url: str) -> Remote:
760 return repo.remotes.create('custom_remote', url)
761
762 repo = clone_repository(
763 url, repo_path, repository=create_repository, remote=create_remote
764 )
765 assert not repo.is_empty
766 assert 'refs/remotes/custom_remote/master' in repo.listall_references()
767 assert b'refs/remotes/custom_remote/master' in repo.raw_listall_references()
768 assert repo.remotes['custom_remote'] is not None
769
770
771@utils.requires_network

Callers

nothing calls this directly

Calls 2

clone_repositoryFunction · 0.90
listall_referencesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…