Presubmit: Don't forget to warn when changing headers in subdirs of api/
Unlike all the other API directories, api/ is the root of an entire
tree of directories that are also API directories.
BUG=webrtc:8445
Change-Id: I218befe6fb6113b95599512f062ebe63abc98889
Reviewed-on: https://webrtc-review.googlesource.com/15321
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20427}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 3ed3728..c72fc19 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -62,7 +62,7 @@
# webrtc-users@google.com (internal list).
# 4. (later) The deprecated APIs are removed.
NATIVE_API_DIRS = (
- 'api',
+ 'api', # All subdirectories of api/ are included as well.
'media',
'modules/audio_device/include',
'pc',
@@ -160,8 +160,15 @@
for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
if f.LocalPath().endswith('.h'):
for path in API_DIRS:
- if os.path.dirname(f.LocalPath()) == path:
- files.append(f)
+ dn = os.path.dirname(f.LocalPath())
+ if path == 'api':
+ # Special case: Subdirectories included.
+ if dn == 'api' or dn.startswith('api/'):
+ files.append(f)
+ else:
+ # Normal case: Subdirectories not included.
+ if dn == path:
+ files.append(f)
if files:
return [output_api.PresubmitNotifyResult(API_CHANGE_MSG, files)]