From 998dbd56e53c8c8c8bc1a425cec16b6ccc752e34 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 8 Aug 2026 13:01:07 +0200 Subject: hooks: fix pre-commit sbolint never running The sbolint loop extracted build dirs with "cut -d/ -f1,2", which is correct for SBo's own // layout but yields a file path in this repo's flat / layout (e.g. nuclei/nuclei.info). The guard then tested nuclei/nuclei.info/slack-desc, which never exists, so sbolint was silently skipped on every package commit. Walk up from each changed file to the directory holding the .SlackBuild instead. Depth is no longer assumed, so this works for the current flat layout and for // after the planned migration. --- .extras/hooks/pre-commit | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to '.extras/hooks/pre-commit') diff --git a/.extras/hooks/pre-commit b/.extras/hooks/pre-commit index d2f9506..7158125 100755 --- a/.extras/hooks/pre-commit +++ b/.extras/hooks/pre-commit @@ -72,7 +72,22 @@ if [ "${SBOLINT:-yes}" = "yes" ]; then if [ -e "$build/slack-desc" -o -e "$build/README" ]; then sbolint "$build" || sbolintfailed=1 fi - done < <(git diff --cached --name-only | cut -d/ -f1,2 | sort -u) + done < <(git diff --cached --name-only | while IFS= read -r f; do + # Walk up from the changed file to the directory that holds + # the .SlackBuild: that's the build dir sbolint wants. Depth + # isn't assumed, so this works for both a flat layout + # (/) and SBo's own (//). Root-level + # files (CLAUDE.md, .extras/...) walk up to "." and are + # dropped, they aren't builds. + d=$(dirname "$f") + while [ "$d" != "." ] && [ "$d" != "/" ]; do + if compgen -G "$d/*.SlackBuild" >/dev/null; then + printf '%s\n' "$d" + break + fi + d=$(dirname "$d") + done + done | sort -u) fi if [ -n "$sbolintfailed" ]; then echo "*** sbolint failed, fix the errors or set SBOLINT=no" -- cgit v1.2.3