Index: presubmit_canned_checks.py |
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py |
index 014af28ae2fdd176f4ee27d335417f87939ca5b5..52d93b4fba926ddd95853d4c1e53d3de02722491 100644 |
--- a/presubmit_canned_checks.py |
+++ b/presubmit_canned_checks.py |
@@ -275,13 +275,16 @@ def CheckLongLines(input_api, output_api, maxlen=80, source_file_filter=None): |
return [] |
-def CheckLicense(input_api, output_api, license, source_file_filter=None): |
+def CheckLicense(input_api, output_api, license, source_file_filter=None, |
+ accept_empty_files=True): |
"""Verifies the license header. |
""" |
license_re = input_api.re.compile(license, input_api.re.MULTILINE) |
bad_files = [] |
for f in input_api.AffectedSourceFiles(source_file_filter): |
contents = input_api.ReadFile(f, 'rb') |
+ if accept_empty_files and not contents: |
+ continue |
if not license_re.search(contents): |
bad_files.append(f.LocalPath()) |
if bad_files: |