From 1a5a618608137182fb980e91b92dbf6f580557b9 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 31 Aug 2024 07:49:23 -0700 Subject: [PATCH] fix: handle GitCommandNotFound exception in make_new_repo function --- aider/main.py | 2 +- tests/basic/test_main.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/main.py b/aider/main.py index 0e5792e4e..184974d29 100644 --- a/aider/main.py +++ b/aider/main.py @@ -57,7 +57,7 @@ def make_new_repo(git_root, io): try: repo = git.Repo.init(git_root) check_gitignore(git_root, io, False) - except gitdb.exc.ODBError as err: # issue #1233 + except (gitdb.exc.ODBError, git.exc.GitCommandNotFound) as err: # issue #1233 io.tool_error(f"Unable to create git repo in {git_root}") io.tool_error(str(err)) return diff --git a/tests/basic/test_main.py b/tests/basic/test_main.py index 3a592beb9..ab7278b28 100644 --- a/tests/basic/test_main.py +++ b/tests/basic/test_main.py @@ -625,7 +625,7 @@ class TestMain(TestCase): mock_git_init.side_effect = git.exc.GitCommandNotFound("git", "Command 'git' not found") try: - result = main(["--exit"], input=DummyInput(), output=DummyOutput()) + result = main(["--exit", "--yes"], input=DummyInput(), output=DummyOutput()) except Exception as e: self.fail(f"main() raised an unexpected exception: {e}")