From 54ee5820b31cc42a80271a30b5ac586bc667377b Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Tue, 21 Feb 2017 13:20:59 +0000 Subject: [PATCH] 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. --- scripts/filter_lint_by_diff.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/filter_lint_by_diff.py b/scripts/filter_lint_by_diff.py index a5900dd7e81..534c642a6ba 100755 --- a/scripts/filter_lint_by_diff.py +++ b/scripts/filter_lint_by_diff.py @@ -15,6 +15,9 @@ diff = unidiff.PatchSet(f) for diff_file in diff: filename = diff_file.target_file + # Skip files deleted in the tip (b side of the diff): + if filename == "/dev/null": + continue assert filename.startswith("b/") filename = os.path.join(repository_root, filename[2:]) added_lines.add((filename, 0))