Skip to content

Commit 54ee582

Browse files
committed
Fix lint filter against deleted files. Fixes #563
git-diff when a file has been removed diffs against /dev/null instead of the usual pattern `b/some/path/to/file.cpp`. This change avoids asserting a "b/" prefix in that case.
1 parent 74fa240 commit 54ee582

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/filter_lint_by_diff.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
diff = unidiff.PatchSet(f)
1616
for diff_file in diff:
1717
filename = diff_file.target_file
18+
# Skip files deleted in the tip (b side of the diff):
19+
if filename == "/dev/null":
20+
continue
1821
assert filename.startswith("b/")
1922
filename = os.path.join(repository_root, filename[2:])
2023
added_lines.add((filename, 0))

0 commit comments

Comments
 (0)