diff --git a/project.py b/project.py index 308d0f8ad..f1d26c5a2 100644 --- a/project.py +++ b/project.py @@ -4511,9 +4511,10 @@ class Project: "filter.lfs.process", "git-lfs filter-process --skip", ) - curr_config.SetBoolean( - "core.bare", True if self.manifest.IsMirror else None - ) + if self.manifest.IsMirror: + curr_config.SetBoolean("core.bare", True) + elif curr_config.GetBoolean("core.bare"): + curr_config.SetBoolean("core.bare", None) if tmp_gitdir: platform_utils.rename(tmp_gitdir, self.gitdir) diff --git a/tests/test_project.py b/tests/test_project.py index 79307ab5f..85c8cd906 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -5179,8 +5179,14 @@ class InitGitDirConfigTests(unittest.TestCase): any("--replace-all" in cmd for cmd in seen_cmds), f"Expected BatchWrites to avoid --replace-all, got {seen_cmds}", ) + self.assertFalse( + any("core.bare" in cmd for cmd in seen_cmds), + f"Expected local init to avoid core.bare config spawns: " + f"{seen_cmds}", + ) reloaded = git_config.GitConfig.ForRepository(gitdir=proj.gitdir) fresh = reloaded._ReadGit() + self.assertEqual(["false"], fresh.get("core.bare")) self.assertEqual( ["git-lfs smudge --skip -- %f"], fresh.get("filter.lfs.smudge") )