handle if only a rename happened and no diff block is returned

This commit is contained in:
Bence Pőcze 2023-09-14 15:46:29 +02:00
parent a591f1c56d
commit 52796e95cf

View File

@ -61,6 +61,12 @@ class LineShiftChecker:
shifted_lines[f'{file_info["src"]}:{old_start}'] = None shifted_lines[f'{file_info["src"]}:{old_start}'] = None
old_start += 1 old_start += 1
if not diff_started:
# it was a pure rename, so no diff blocks were returned,
# we just put the lines into the dict
shifted_lines = {f'{file_info["src"]}:{i}': f'{file_info["dst"]}:{i}'
for i in range(0, lines_in_source_file)}
assert lines_in_source_file == len(shifted_lines) assert lines_in_source_file == len(shifted_lines)
return shifted_lines return shifted_lines