From a84b4f8144c84d557dc8c5b280965f46ee182a74 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 12 Apr 2024 08:23:59 -0700 Subject: [PATCH] Add the ability to add images that are located outside the git repo #519 --- aider/commands.py | 2 +- aider/repo.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/aider/commands.py b/aider/commands.py index 05b8e04d0..602b11dd4 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -367,7 +367,7 @@ class Commands: for matched_file in all_matched_files: abs_file_path = self.coder.abs_root_path(matched_file) - if not abs_file_path.startswith(self.coder.root): + if not abs_file_path.startswith(self.coder.root) and not is_image_file(matched_file): self.io.tool_error( f"Can not add {abs_file_path}, which is not within {self.coder.root}" ) diff --git a/aider/repo.py b/aider/repo.py index 0e42b7552..cab1f7606 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -215,7 +215,10 @@ class GitRepo: if not self.aider_ignore_file or not self.aider_ignore_file.is_file(): return - fname = self.normalize_path(fname) + try: + fname = self.normalize_path(fname) + except ValueError: + return mtime = self.aider_ignore_file.stat().st_mtime if mtime != self.aider_ignore_ts: