mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
fix: Preserve original path spelling for read-only files
This commit is contained in:
parent
1d5c3c3a2b
commit
9297ee982d
1 changed files with 14 additions and 5 deletions
|
@ -435,11 +435,20 @@ class Commands:
|
|||
to_keep = set()
|
||||
for abs_fname in self.coder.abs_read_only_fnames:
|
||||
rel_fname = self.coder.get_rel_fname(abs_fname)
|
||||
keep = any(
|
||||
_paths_match(abs_fname, orig) or rel_fname == orig
|
||||
for orig in self.original_read_only_fnames
|
||||
)
|
||||
if keep:
|
||||
|
||||
# Prefer to keep the *original* spelling that the user supplied
|
||||
# (eg the /var/… symlink) rather than the canonicalised path we
|
||||
# may have stored internally. This preserves exactly what the
|
||||
# user (and the tests) expect to see.
|
||||
kept_name = None
|
||||
for orig in self.original_read_only_fnames:
|
||||
if _paths_match(abs_fname, orig) or rel_fname == orig:
|
||||
kept_name = str(orig)
|
||||
break
|
||||
|
||||
if kept_name:
|
||||
to_keep.add(kept_name)
|
||||
else:
|
||||
to_keep.add(abs_fname)
|
||||
self.coder.abs_read_only_fnames = to_keep
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue