From 1d0d91d71e33663c7223e4a5db5e2730b53dcd9a Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 27 Sep 2023 18:32:18 -0700 Subject: [PATCH] improved gitignore check logic --- aider/main.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/aider/main.py b/aider/main.py index 00489504c..dab1ea1e7 100644 --- a/aider/main.py +++ b/aider/main.py @@ -70,12 +70,14 @@ def setup_git(git_root, io): return repo.working_tree_dir -import git - def check_gitignore(git_root, io, ask=True): if not git_root: return + repo = git.Repo(git_root) + if repo.ignored(".aider"): + return + pat = ".aider*" gitignore_file = Path(git_root) / ".gitignore" @@ -86,10 +88,6 @@ def check_gitignore(git_root, io, ask=True): else: content = "" - repo = git.Repo(git_root) - if repo.is_ignored(pat): - return - if ask and not io.confirm_ask(f"Add {pat} to .gitignore (recommended)?"): return