summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Rothenpieler <[email protected]>2025-09-12 19:19:30 +0200
committerMartin Storsjö <[email protected]>2025-09-13 20:58:29 +0000
commit4c80cda08ab41a37bea430b5803d84298a145b2c (patch)
tree95b8bdcbbc72439096fd62cdba4f3e912ad67e8a
parentedd1b93e5316612e5020a14fdf9e62f94f615826 (diff)
forgejo: make aarch64 asm linter part of pre-commit
Needed some minor semantical changes to the shell wrapper, since pre-commit expects it to exit with an error when applying fixes.
-rw-r--r--.forgejo/pre-commit/config.yaml8
-rw-r--r--.forgejo/workflows/lint.yml2
-rwxr-xr-xtools/check_arm_indent.sh13
3 files changed, 15 insertions, 8 deletions
diff --git a/.forgejo/pre-commit/config.yaml b/.forgejo/pre-commit/config.yaml
index 9a7041543f..f1ab7765ef 100644
--- a/.forgejo/pre-commit/config.yaml
+++ b/.forgejo/pre-commit/config.yaml
@@ -18,6 +18,14 @@ repos:
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
+- repo: local
+ hooks:
+ - id: aarch64-asm-indent
+ name: fix aarch64 assembly indentation
+ files: ^.*/aarch64/.*\.S$
+ language: script
+ entry: ./tools/check_arm_indent.sh --apply
+ pass_filenames: false
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
index afbdba89a2..42e925ad8b 100644
--- a/.forgejo/workflows/lint.yml
+++ b/.forgejo/workflows/lint.yml
@@ -24,5 +24,3 @@ jobs:
key: pre-commit-${{ steps.install.outputs.envhash }}
- name: Run pre-commit CI
run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
- - name: Check aarch64 assembly indentation
- run: ./tools/check_arm_indent.sh
diff --git a/tools/check_arm_indent.sh b/tools/check_arm_indent.sh
index b8bc7b1eb7..5becfe0aec 100755
--- a/tools/check_arm_indent.sh
+++ b/tools/check_arm_indent.sh
@@ -39,12 +39,13 @@ for i in */aarch64/*.S */aarch64/*/*.S; do
# Skip files with known (and tolerated) deviations from the tool.
continue
esac
- cat $i | ./tools/indent_arm_assembly.pl > tmp.S
- if [ -n "$apply" ]; then
- mv tmp.S $i
- continue
- fi
- if ! PAGER=cat git diff --no-index $i tmp.S; then
+ ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$?
+ if ! git diff --quiet --no-index "$i" tmp.S; then
+ if [ -n "$apply" ]; then
+ mv tmp.S "$i"
+ else
+ git --no-pager diff --no-index "$i" tmp.S
+ fi
ret=1
fi
done