Fix extracting file path from diff headers in udiff_coder.

This commit is contained in:
Paul Gauthier 2023-12-31 09:42:19 -08:00
parent 4dee2ab2f4
commit dc4bec2986

View file

@ -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