mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
fixed corner case bugs in find_original_update_blocks
This commit is contained in:
parent
87c902b285
commit
445c253abc
1 changed files with 10 additions and 6 deletions
|
@ -230,13 +230,15 @@ def find_original_update_blocks(content):
|
||||||
processed.append(cur) # original_marker
|
processed.append(cur) # original_marker
|
||||||
|
|
||||||
filename = processed[-2].splitlines()[-1].strip()
|
filename = processed[-2].splitlines()[-1].strip()
|
||||||
try:
|
try:
|
||||||
if not len(filename) or "`" in filename:
|
if not len(filename) or "`" in filename:
|
||||||
filename = processed[-2].splitlines()[-2].strip()
|
filename = processed[-2].splitlines()[-2].strip()
|
||||||
if not len(filename) or "`" in filename:
|
if not len(filename) or "`" in filename:
|
||||||
|
raise ValueError(
|
||||||
|
f"Bad/missing filename. It should go right above {ORIGINAL}"
|
||||||
|
)
|
||||||
|
except IndexError:
|
||||||
raise ValueError(f"Bad/missing filename. It should go right above {ORIGINAL}")
|
raise ValueError(f"Bad/missing filename. It should go right above {ORIGINAL}")
|
||||||
except IndexError:
|
|
||||||
raise ValueError(f"Bad/missing filename. It should go right above {ORIGINAL}")
|
|
||||||
|
|
||||||
original_text = pieces.pop()
|
original_text = pieces.pop()
|
||||||
processed.append(original_text)
|
processed.append(original_text)
|
||||||
|
@ -247,8 +249,10 @@ def find_original_update_blocks(content):
|
||||||
raise ValueError(f"Expected {DIVIDER}")
|
raise ValueError(f"Expected {DIVIDER}")
|
||||||
|
|
||||||
updated_text = pieces.pop()
|
updated_text = pieces.pop()
|
||||||
|
processed.append(updated_text)
|
||||||
|
|
||||||
updated_marker = pieces.pop()
|
updated_marker = pieces.pop()
|
||||||
|
processed.append(updated_marker)
|
||||||
if updated_marker.strip() != UPDATED:
|
if updated_marker.strip() != UPDATED:
|
||||||
raise ValueError(f"Expected {UPDATED}")
|
raise ValueError(f"Expected {UPDATED}")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue