diff --git a/aider/main.py b/aider/main.py index 5dee72fb0..00489504c 100644 --- a/aider/main.py +++ b/aider/main.py @@ -70,6 +70,8 @@ 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 @@ -84,6 +86,10 @@ 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