refactor: Simplify gitignore check and error handling logic

This commit is contained in:
Paul Gauthier 2025-02-04 08:04:16 -08:00 committed by Paul Gauthier (aider)
parent 88ee089d86
commit bc2f38c790

View file

@ -162,6 +162,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"):
patterns_to_add.append(".env")
@ -183,6 +185,7 @@ def check_gitignore(git_root, io, ask=True):
content = ""
except ANY_GIT_ERROR:
return
if ask:
io.tool_output("You can skip this check with --no-gitignore")
if not io.confirm_ask(f"Add {', '.join(patterns_to_add)} to .gitignore (recommended)?"):