From dc4bec298673e4fbcc6a270ad1ecc43f9127c6fc Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sun, 31 Dec 2023 09:42:19 -0800 Subject: [PATCH] Fix extracting file path from diff headers in udiff_coder. --- aider/coders/udiff_coder.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/aider/coders/udiff_coder.py b/aider/coders/udiff_coder.py index 05583a08d..189aea3e5 100644 --- a/aider/coders/udiff_coder.py +++ b/aider/coders/udiff_coder.py @@ -334,11 +334,9 @@ def process_fenced_block(lines, start_line_num): block = lines[start_line_num:line_num] block.append("@@ @@") - if block[1].startswith("--- ") and block[2].startswith("+++ "): + if block[0].startswith("--- ") and block[1].startswith("+++ "): # Extract the file path, considering that it might contain spaces fname = block[1][4:].strip() - # Ensure that the file path is the same for both the original and new file - assert fname == block[2][4:].strip(), "File paths in diff headers do not match" block = block[2:] else: fname = None