diff --git a/aider/commands.py b/aider/commands.py index b9a3d3c2a20..e4567684c89 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -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( diff --git a/aider/repo.py b/aider/repo.py index e4597c8e4d0..92b5e3bf5b8 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -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