diff --git a/aider/commands.py b/aider/commands.py index 32755d72d..c5b269db1 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -609,13 +609,13 @@ class Commands: filenames = parse_quoted_filenames(args) for word in filenames: - # Handle read-only files separately + # Handle read-only files separately, without glob_filtered_to_repo 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) diff --git a/tests/basic/test_commands.py b/tests/basic/test_commands.py index 3e772082d..a7a895c0b 100644 --- a/tests/basic/test_commands.py +++ b/tests/basic/test_commands.py @@ -779,8 +779,6 @@ class TestCommands(TestCase): # Test dropping the external read-only file commands.cmd_drop(Path(external_file_path).name) - print(coder.abs_read_only_fnames) - # Check if the file was removed from abs_read_only_fnames self.assertFalse( any(