From e7d979ca745b799219c500074954154bdaec9ac1 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 4 Feb 2025 08:04:17 -0800 Subject: [PATCH] feat: Conditionally add .env to .gitignore based on file existence --- aider/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/main.py b/aider/main.py index eabcf7c99..5205cef96 100644 --- a/aider/main.py +++ b/aider/main.py @@ -163,8 +163,8 @@ def check_gitignore(git_root, io, ask=True): if not repo.ignored(".aider"): patterns_to_add.append(".aider*") - # only check .env if git_root/.env exists ai! - if not repo.ignored(".env"): + env_path = Path(git_root) / ".env" + if env_path.exists() and not repo.ignored(".env"): patterns_to_add.append(".env") if not patterns_to_add: