From 6f09f651a171f25b4f57f8bf89d550bdc26f03c0 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 28 Aug 2024 15:28:05 -0700 Subject: [PATCH] fix: Set git_root to None if no git repositories are found in the home directory --- aider/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aider/main.py b/aider/main.py index 87a624921..32d018f32 100644 --- a/aider/main.py +++ b/aider/main.py @@ -25,6 +25,7 @@ from .dump import dump # noqa: F401 def setup_git_home(io): home = Path.home() git_repos = list(home.glob("*/.git")) + git_root = None if git_repos: io.tool_output("Found git repositories in your home directory:") @@ -61,6 +62,9 @@ def setup_git_home(io): else: return # no response + if not git_root: + return + if git_root.exists(): if git_root.is_dir(): os.chdir(git_root)