diff --git a/aider/commands.py b/aider/commands.py index 125c91163..df58bf428 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -328,7 +328,7 @@ class Commands: self.io.tool_error(f"No files matched '{word}'") for matched_file in matched_files: - abs_fname = str(Path(matched_file).resolve()) + abs_fname = self.coder.abs_root_path(matched_file) 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") diff --git a/tests/test_commands.py b/tests/test_commands.py index bca022a24..a332665d0 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -127,6 +127,12 @@ class TestCommands(TestCase): # it should be there, but was not in v0.10.0 self.assertIn(abs_fname, coder.abs_fnames) + # drop it via it's git_root referenced name + commands.cmd_drop("test_dir/another_dir/test_file.txt") + + # it should be there, but was not in v0.10.0 + self.assertNotIn(abs_fname, coder.abs_fnames) + def test_cmd_drop_with_glob_patterns(self): # Initialize the Commands and InputOutput objects io = InputOutput(pretty=False, yes=True)