From 7ccb4bb83e2b4a1bb8f7f8d9af263b91d7fc26e3 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Mon, 7 Nov 2011 20:26:20 +0000 Subject: [PATCH] Blacklist .diff and .patch files Otherwise, silly checks like EOL whitespace triggers constantly. R=dpranke@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/8494013 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@108899 0039d316-1c4b-4281-b951-d872f2087c98 --- presubmit_support.py | 3 +++ tests/presubmit_unittest.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/presubmit_support.py b/presubmit_support.py index 0efaca1c8d..b2a94bc24b 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -216,6 +216,9 @@ class InputApi(object): # SCM (can happen in dual SCM configuration). (Slightly over aggressive) r"(|.*[\\\/])\.git[\\\/].*", r"(|.*[\\\/])\.svn[\\\/].*", + # There is no point in processing a patch file. + r".+\.diff$", + r".+\.patch$", ) def __init__(self, change, presubmit_path, is_committing, diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index 8c25038231..c43bc4f8a2 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -1020,6 +1020,8 @@ class InputApiUnittest(PresubmitTestsBase): f('b.c/.git'), f('a/.git/bleh.py'), f('.git/bleh.py'), + f('bleh.diff'), + f('foo/bleh.patch'), ], [ # Expected. @@ -1031,7 +1033,7 @@ class InputApiUnittest(PresubmitTestsBase): self.mox.ReplayAll() self.assertEqual(len(input_api.DEFAULT_WHITE_LIST), 21) - self.assertEqual(len(input_api.DEFAULT_BLACK_LIST), 9) + self.assertEqual(len(input_api.DEFAULT_BLACK_LIST), 11) for item in files: results = filter(input_api.FilterSourceFile, item[0]) for i in range(len(results)):