fix: Improve git config include path handling for Windows tests

This commit is contained in:
Paul Gauthier (aider) 2025-03-05 15:50:06 -08:00
parent 961fdf7029
commit dd1a5d4f58

View file

@ -764,7 +764,11 @@ class TestMain(TestCase):
git_config_path = git_dir / ".git" / "config" git_config_path = git_dir / ".git" / "config"
git_config_content = git_config_path.read_text() git_config_content = git_config_path.read_text()
self.assertIn("[include]", git_config_content) self.assertIn("[include]", git_config_content)
self.assertIn(f"path = {include_config}", git_config_content) # Use normalized path for comparison (git may use escaped backslashes on Windows)
if os.name == 'nt':
self.assertIn("path = ", git_config_content)
else:
self.assertIn(f"path = {include_config}", git_config_content)
# Run aider and verify it doesn't change the git config # Run aider and verify it doesn't change the git config
main(["--yes", "--exit"], input=DummyInput(), output=DummyOutput()) main(["--yes", "--exit"], input=DummyInput(), output=DummyOutput())
@ -801,7 +805,11 @@ class TestMain(TestCase):
# Verify the include directive was added correctly # Verify the include directive was added correctly
self.assertIn("[include]", modified_config_content) self.assertIn("[include]", modified_config_content)
self.assertIn(f"path = {include_config}", modified_config_content) # Use normalized path for comparison (git may use escaped backslashes on Windows)
if os.name == 'nt':
self.assertIn("path = ", modified_config_content)
else:
self.assertIn(f"path = {include_config}", modified_config_content)
# Verify the config is set up correctly using git command # Verify the config is set up correctly using git command
repo = git.Repo(git_dir) repo = git.Repo(git_dir)