From bcdc0217b3249ed0698da1e6f8dd14f436327907 Mon Sep 17 00:00:00 2001 From: apaz-cli Date: Fri, 20 Dec 2024 10:09:07 -0600 Subject: [PATCH] Don't add .env to gitignore when it doesn't exist. --- aider/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aider/main.py b/aider/main.py index 4e6aa1564..8b2cd3b24 100644 --- a/aider/main.py +++ b/aider/main.py @@ -173,7 +173,8 @@ def check_gitignore(git_root, io, ask=True): existing_lines = content.splitlines() for pat in patterns: if pat not in existing_lines: - patterns_to_add.append(pat) + if '*' in pat or (Path(git_root) / pat).exists(): + patterns_to_add.append(pat) except OSError as e: io.tool_error(f"Error when trying to read {gitignore_file}: {e}") return