aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-01-03 10:09:00 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-01-03 10:09:00 +0000
commit2976a4d245c1ad0887873f24d9ae7d2ca7939b57 (patch)
tree52cec87e70718b4efea41504bde845addb0022e3
parent4123f306f792142e148708b99e0d6484e05d3a92 (diff)
parente2217142cf18e5a894c94eefe120a22bb8b852db (diff)
downloadrepohooks-2976a4d245c1ad0887873f24d9ae7d2ca7939b57.tar.gz
Merge "hooks: bpfmt: display formatting diff on errors" into mainub-automotive-master-20240125androidx-test-uiautomator-releaseandroidx-graphics-release
-rw-r--r--rh/hooks.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/rh/hooks.py b/rh/hooks.py
index 1168720..6cb92a0 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -346,15 +346,17 @@ def check_bpfmt(project, commit, _desc, diff, options=None):
bpfmt = options.tool_path('bpfmt')
bpfmt_options = options.args((), filtered)
- cmd = [bpfmt, '-l'] + bpfmt_options
+ cmd = [bpfmt, '-d'] + bpfmt_options
+ fixup_cmd = [bpfmt, '-w']
+ if '-s' in bpfmt_options:
+ fixup_cmd.append('-s')
+ fixup_cmd.append('--')
+
ret = []
for d in filtered:
data = rh.git.get_file_content(commit, d.file)
result = _run(cmd, input=data)
if result.stdout:
- fixup_cmd = [bpfmt, '-w']
- if '-s' in bpfmt_options:
- fixup_cmd.append('-s')
ret.append(rh.results.HookResult(
'bpfmt', project, commit,
error=result.stdout,