mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-07 05:05:01 +00:00
fix: handle empty original content when creating new files
This commit is contained in:
parent
85f23b3408
commit
c71a92ac84
2 changed files with 44 additions and 1 deletions
|
@ -52,7 +52,10 @@ class EditBlockCoder(Coder):
|
|||
content = self.io.read_text(full_path)
|
||||
new_content = do_replace(full_path, content, original, updated, self.fence)
|
||||
|
||||
if not new_content:
|
||||
# If the edit failed, and
|
||||
# this is not a "create a new file" with an empty original...
|
||||
# https://github.com/Aider-AI/aider/issues/2258
|
||||
if not new_content and original.strip():
|
||||
# try patching any of the other files in the chat
|
||||
for full_path in self.abs_fnames:
|
||||
content = self.io.read_text(full_path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue