Skip to content
Snippets Groups Projects
Commit e976c352 authored by James Addison's avatar James Addison :speech_balloon:
Browse files

Salsa issue #372: maintain in-header boolean state to determine whether to...

Salsa issue #372: maintain in-header boolean state to determine whether to drop from-file/to-file lines.
parent 067a8d1c
No related branches found
No related tags found
1 merge request!141Unified diff parsing: maintain in-header boolean state to determine whether to drop from-file/to-file lines.
Pipeline #675809 failed
......@@ -661,20 +661,21 @@ class SideBySideDiff:
"""
self.reset()
diff_lines = iter(diff_split_lines(self.unified_diff, False))
for l in diff_lines:
in_header = True
for l in diff_split_lines(self.unified_diff, False):
self._bytes_processed += len(l) + 1
m = re.match(r"^--- ([^\s]*)", l)
if m:
if m and in_header:
yield from self.empty_buffer()
continue
m = re.match(r"^\+\+\+ ([^\s]*)", l)
if m:
if m and in_header:
yield from self.empty_buffer()
continue
m = re.match(r"@@ -(\d+),?(\d*) \+(\d+),?(\d*)", l)
if m:
in_header = False
yield from self.empty_buffer()
hunk_data = map(lambda x: x == "" and 1 or int(x), m.groups())
(
......@@ -690,10 +691,8 @@ class SideBySideDiff:
self.hunk_off2,
self.hunk_size2,
)
break
continue
for l in diff_lines:
self._bytes_processed += len(l) + 1
if re.match(r"^\[", l):
yield from self.empty_buffer()
yield "C", l
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment