From c9d4c8d09b3de1abdd68676f96a407a00ab2ff31 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Mon, 7 Apr 2025 13:19:25 +1200 Subject: [PATCH] fix: allow adding files by full path with existing basename --- aider/coders/base_coder.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 902b95033..9e16755e6 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -1626,10 +1626,6 @@ class Coder: mentioned_rel_fnames = set() fname_to_rel_fnames = {} for rel_fname in addable_rel_fnames: - # Skip files that share a basename with files already in chat - if os.path.basename(rel_fname) in existing_basenames: - continue - normalized_rel_fname = rel_fname.replace("\\", "/") normalized_words = set(word.replace("\\", "/") for word in words) if normalized_rel_fname in normalized_words: @@ -1644,6 +1640,10 @@ class Coder: fname_to_rel_fnames[fname].append(rel_fname) for fname, rel_fnames in fname_to_rel_fnames.items(): + # If the basename is already in chat, don't add based on a basename mention + if fname in existing_basenames: + continue + # If the basename mention is unique among addable files and present in the text if len(rel_fnames) == 1 and fname in words: mentioned_rel_fnames.add(rel_fnames[0])