feat: Conditionally add .env to .gitignore based on file existence

This commit is contained in:
Paul Gauthier (aider) 2025-02-04 08:04:17 -08:00
parent bc2f38c790
commit e7d979ca74

View file

@ -163,8 +163,8 @@ def check_gitignore(git_root, io, ask=True):
if not repo.ignored(".aider"): if not repo.ignored(".aider"):
patterns_to_add.append(".aider*") patterns_to_add.append(".aider*")
# only check .env if git_root/.env exists ai! env_path = Path(git_root) / ".env"
if not repo.ignored(".env"): if env_path.exists() and not repo.ignored(".env"):
patterns_to_add.append(".env") patterns_to_add.append(".env")
if not patterns_to_add: if not patterns_to_add: