Author: mydeveloperday Date: 2021-10-20T09:07:12+01:00 New Revision: 5e969125c6094b909493bcd8360497adcdf8f6f5
URL: https://github.com/llvm/llvm-project/commit/5e969125c6094b909493bcd8360497adcdf8f6f5 DIFF: https://github.com/llvm/llvm-project/commit/5e969125c6094b909493bcd8360497adcdf8f6f5.diff LOG: [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 Added: Modified: clang/tools/clang-format/git-clang-format Removed: ################################################################################ diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format index 40e848d55a8c..c7e15eb7b483 100755 --- a/clang/tools/clang-format/git-clang-format +++ b/clang/tools/clang-format/git-clang-format @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits