Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5e08775

Browse files
committedAug 25, 2024
test(conftest): disable 'safe.directory' Git config for container bound sources
Details: The git sources folder ownership may be detected as dubious if running in a container with sources mounted to work on fixes and tests, breaking 'test_find_git_project_root' and 'test_get_commits_with_signature' > commitizen.exceptions.GitCommandError: fatal: detected dubious ownership in repository at '...' --- Signed-off-by: Adrian DC <radian.dc@gmail.com>
1 parent c801263 commit 5e08775

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎tests/conftest.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,19 @@ def git_sandbox(monkeypatch: pytest.MonkeyPatch, tmp_path: Path):
3535
gitconfig = tmp_path / ".git" / "config"
3636
if not gitconfig.parent.exists():
3737
gitconfig.parent.mkdir()
38+
3839
monkeypatch.setenv("GIT_CONFIG_GLOBAL", str(gitconfig))
40+
3941
r = cmd.run(f"git config --file {gitconfig} user.name {SIGNER}")
4042
assert r.return_code == 0, r.err
4143
r = cmd.run(f"git config --file {gitconfig} user.email {SIGNER_MAIL}")
4244
assert r.return_code == 0, r.err
43-
cmd.run("git config --global init.defaultBranch master")
45+
46+
r = cmd.run(f"git config --file {gitconfig} safe.directory '*'")
47+
assert r.return_code == 0, r.err
48+
49+
r = cmd.run("git config --global init.defaultBranch master")
50+
assert r.return_code == 0, r.err
4451

4552

4653
@pytest.fixture

0 commit comments

Comments
 (0)
Please sign in to comment.