Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion aider/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,13 @@ def cmd_add(self, args):
self.io.tool_error(f"{matched_file} is already in the chat as an editable file")
continue
elif abs_file_path in self.coder.abs_read_only_fnames:
if self.coder.repo and self.coder.repo.path_in_repo(matched_file):
# Determine if file can be promoted to editable
if self.coder.repo:
can_edit = self.coder.repo.path_in_repo(matched_file)
else:
can_edit = abs_file_path.startswith(self.coder.root)

if can_edit:
self.coder.abs_read_only_fnames.remove(abs_file_path)
self.coder.abs_fnames.add(abs_file_path)
self.io.tool_output(
Expand Down
3 changes: 2 additions & 1 deletion aider/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,8 @@ def path_in_repo(self, path):
return

tracked_files = set(self.get_tracked_files())
return self.normalize_path(path) in tracked_files
normalized = self.normalize_path(path)
return normalized in tracked_files

def abs_root_path(self, path):
res = Path(self.root) / path
Expand Down