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

Function test_open_extended

test/test_repository.py:952–983  ·  view source on GitHub ↗
(tmp_path: Path)

Source from the content-addressed store, hash-verified

950
951
952def test_open_extended(tmp_path: Path) -> None:
953 with utils.TemporaryRepository('dirtyrepo.zip', tmp_path) as path:
954 orig_repo = pygit2.Repository(path)
955 assert not orig_repo.is_bare
956 assert orig_repo.path
957 assert orig_repo.workdir
958
959 # GIT_REPOSITORY_OPEN_NO_SEARCH
960 subdir_path = path / 'subdir'
961 repo = pygit2.Repository(subdir_path)
962 assert not repo.is_bare
963 assert repo.path == orig_repo.path
964 assert repo.workdir == orig_repo.workdir
965
966 with pytest.raises(pygit2.GitError):
967 repo = pygit2.Repository(subdir_path, RepositoryOpenFlag.NO_SEARCH)
968
969 # GIT_REPOSITORY_OPEN_NO_DOTGIT
970 gitdir_path = path / '.git'
971 with pytest.raises(pygit2.GitError):
972 repo = pygit2.Repository(path, RepositoryOpenFlag.NO_DOTGIT)
973
974 repo = pygit2.Repository(gitdir_path, RepositoryOpenFlag.NO_DOTGIT)
975 assert not repo.is_bare
976 assert repo.path == orig_repo.path
977 assert repo.workdir == orig_repo.workdir
978
979 # GIT_REPOSITORY_OPEN_BARE
980 repo = pygit2.Repository(gitdir_path, RepositoryOpenFlag.BARE)
981 assert repo.is_bare
982 assert repo.path == orig_repo.path
983 assert not repo.workdir
984
985
986def test_is_shallow(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…