From e42a7caf1be87560e072069cbcb3024584adcd7b Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 9 Aug 2024 17:03:17 -0400 Subject: [PATCH] fix: Handle read-only files separately in cmd_drop --- aider/commands.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/aider/commands.py b/aider/commands.py index b6f0f1479..32755d72d 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -609,6 +609,14 @@ class Commands: filenames = parse_quoted_filenames(args) for word in filenames: + # Handle read-only files separately + read_only_matched = [f for f in self.coder.abs_read_only_fnames if word in f] + if read_only_matched: + for matched_file in read_only_matched: + self.coder.abs_read_only_fnames.remove(matched_file) + self.io.tool_output(f"Removed read-only file {matched_file} from the chat") + continue + matched_files = self.glob_filtered_to_repo(word) if not matched_files: @@ -619,9 +627,6 @@ class Commands: if abs_fname in self.coder.abs_fnames: self.coder.abs_fnames.remove(abs_fname) self.io.tool_output(f"Removed {matched_file} from the chat") - elif abs_fname in self.coder.abs_read_only_fnames: - self.coder.abs_read_only_fnames.remove(abs_fname) - self.io.tool_output(f"Removed read-only file {matched_file} from the chat") def cmd_git(self, args): "Run a git command"