Skip to content
Snippets Groups Projects
Commit c4a9e761 authored by Sushil Khanchi's avatar Sushil Khanchi :koala:
Browse files

diff: remove the possibility of getting NameError for newdiffhunk

parent 1602a9e4
No related branches found
No related tags found
3 merge requests!88Merged stable branch into default for release,!87Merged stable branch into default for release,!86diff: fix NameError
Pipeline #28981 passed
......@@ -213,4 +213,5 @@
# For explicitness, let's instantiate a new BytesIO obj for each file
self.curr_diff.patch = BytesIO()
for diffhunk in iter_file_hunks:
self.curr_diff.patch.write(diffhunk)
if diffhunk.startswith(b'@@'):
......@@ -216,8 +217,7 @@
if diffhunk.startswith(b'@@'):
newdiffhunk = diffhunk.split(b'\n', 1)[-1]
lines = newdiffhunk.splitlines(True)
self.curr_diff.patch.write(diffhunk)
self.curr_diff.bytes_count += len(newdiffhunk)
diffhunk = diffhunk.split(b'\n', 1)[-1]
lines = diffhunk.splitlines(True)
self.curr_diff.bytes_count += len(diffhunk)
self.curr_diff.line_count += len(lines)
if self.limits.collapse_diffs:
......
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