aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Moore <devinmoore@google.com>2023-07-11 21:13:43 +0000
committerDevin Moore <devinmoore@google.com>2023-07-12 15:58:25 +0000
commitc13f6bfa45790548c43314db6e51ecc2b5999219 (patch)
tree5fa922b7017e2cc5464ea02b0c8f5250db4f1195
parent338af8dede21fe6cfec1b6020ba2a8f5e4b354d7 (diff)
downloadrepohooks-c13f6bfa45790548c43314db6e51ecc2b5999219.tar.gz
aidl_format: Fix `aidl_api` directory exception for aidl_format hook
It wasn't matching files correctly when the `aidl_api` directory was at the base of the git repository. In those cases the file name shows up as `aidl_api/path/to/files` and doesn't have the path separator in front of `aidl_api/`. Test: upload aosp/2653183 Bug: None Change-Id: Id87a0111f76a46c8cc84a3af57d3cb1deeb54814
-rw-r--r--rh/hooks.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/rh/hooks.py b/rh/hooks.py
index 457a440..162dd6b 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -1012,7 +1012,7 @@ def check_android_test_mapping(project, commit, _desc, diff, options=None):
def check_aidl_format(project, commit, _desc, diff, options=None):
"""Checks that AIDL files are formatted with aidl-format."""
# All *.aidl files except for those under aidl_api directory.
- filtered = _filter_diff(diff, [r'\.aidl$'], [r'/aidl_api/'])
+ filtered = _filter_diff(diff, [r'\.aidl$'], [r'(^|/)aidl_api/'])
if not filtered:
return None
aidl_format = options.tool_path('aidl-format')