[clang-format] git-clang-format throws an assertion when removing files as part of the commit

Following a change {D111273} to allow git-clang-format to see single lines being removed,
we introduced a regression such that if you are removing a whole file it will
assert in clang-format as its given the -lines=0:0  (lines are 1 based)

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D112056
This commit is contained in:
mydeveloperday 2021-10-20 09:04:04 +01:00
parent e9fe8ef4b0
commit 5e969125c6
1 changed files with 2 additions and 0 deletions

View File

@ -327,6 +327,8 @@ def extract_lines(patch_file):
line_count = int(match.group(3))
if line_count == 0:
line_count = 1
if start_line == 0:
continue
matches.setdefault(filename, []).append(Range(start_line, line_count))
return matches