From 56ac57b4cf28b743fd34eb1f429fe3f92f3ac5f9 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 4 Feb 2025 07:58:28 -0800 Subject: [PATCH] feat: Enhance gitignore checking with improved repo ignore detection and pattern handling --- aider/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/aider/main.py b/aider/main.py index 00e303579..ea785968c 100644 --- a/aider/main.py +++ b/aider/main.py @@ -152,10 +152,17 @@ def setup_git(git_root, io): return repo.working_tree_dir +# change this function to check for repo.ignored(.aider) and add `.aider*` to .gitignore if it's not ignored +# check for repo.ignored(.env) and add `.env` to .gitignore if it's not ignored +# stop checking .gitignore for patterns +# ai! def check_gitignore(git_root, io, ask=True): if not git_root: return + # ai: here we use git to check for ignore, which is good because it picks up + # local .gitignore and ~/.global_gitignore and .git/xxxx, etc + # however git is ignoring, we detect it try: repo = git.Repo(git_root) if repo.ignored(".aider") and repo.ignored(".env"): @@ -163,6 +170,8 @@ def check_gitignore(git_root, io, ask=True): except ANY_GIT_ERROR: pass + + # ai: but here, we check for specific patterns only in .gitignore patterns = [".aider*", ".env"] patterns_to_add = []