From 6f460bd050b1c29fe2bfcceade7fae1f417e8249 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 14 Jul 2023 20:10:10 -0700 Subject: [PATCH] wip --- aider/main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/aider/main.py b/aider/main.py index 0d39b34a1..b4332ae30 100644 --- a/aider/main.py +++ b/aider/main.py @@ -340,17 +340,20 @@ def main(args=None, input=None, output=None): git_root = str(Path.cwd().resolve()) if git_root: + updated_ignore = None gitignore_file = Path(git_root) / ".gitignore" if gitignore_file.exists(): - content = gitignore_file.read_text(encoding='utf-8') - if ".aider*" not in content: - gitignore_file.write_text("\n.aider*", encoding='utf-8', append=True) + content = gitignore_file.read_text(encoding="utf-8") + if ".aider*" not in content.splitlines(): + updated_ignore = content + "\n.aider.*\n" else: - gitignore_file.write_text(".aider*", encoding='utf-8') + updated_ignore = "aider.*" + if updated_ignore and io.confirm_ask("Add .aider* to .gitignore (recommended)?"): + gitignore_file.write_text("\n.aider*", encoding="utf-8", append=True) def scrub_sensitive_info(text): # Replace sensitive information with placeholder - return text.replace(args.openai_api_key, '***') + return text.replace(args.openai_api_key, "***") if args.verbose: show = scrub_sensitive_info(parser.format_values())