Allow for single-line deletions in clang_tidy.py (#19082)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19082

When you have just one line of deletions, just as with additions, there is no count printed.
Without this fix, we ignore all globs with single-line deletions when selecting which lines were changed.
When all the changes in the file were single-line, this meant no line-filtering at all!

Differential Revision: D14860426

fbshipit-source-id: c60e9d84f9520871fc0c08fa8c772c227d06fa27
This commit is contained in:
Eric Faust
2019-04-17 16:59:34 -07:00
committed by Facebook Github Bot
parent 242743eedb
commit 48859e3ad3

View File

@ -37,7 +37,8 @@ Patterns = collections.namedtuple("Patterns", "positive, negative")
DEFAULT_FILE_PATTERN = re.compile(r".*\.c(c|pp)?")
# @@ -start,count +start,count @@
CHUNK_PATTERN = r"^@@\s+-\d+,\d+\s+\+(\d+)(?:,(\d+))?\s+@@"
CHUNK_PATTERN = r"^@@\s+-\d+(?:,\d+)?\s+\+(\d+)(?:,(\d+))?\s+@@"
# Set from command line arguments in main().
VERBOSE = False