aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-01-03 10:32:36 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-01-03 10:32:36 +0000
commite106ee3301113116bdc4e11cdb9af60ea946d12b (patch)
tree52cec87e70718b4efea41504bde845addb0022e3
parent4123f306f792142e148708b99e0d6484e05d3a92 (diff)
parent2976a4d245c1ad0887873f24d9ae7d2ca7939b57 (diff)
downloadrepohooks-master.tar.gz
Merge "hooks: bpfmt: display formatting diff on errors" into main am: 2976a4d245HEADub-automotive-master-20240314mastermain
Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/2621057 Change-Id: I86ab7851460c8499a38a513df1cbb9131172d67f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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,