From cf092ef1a1e3253b83f5acc2b9b225adab86631b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Bene=C5=A1?= Date: Sat, 28 Nov 2026 00:06:29 +0000 Subject: [PATCH] hygiene: let the output decide, not xargs' exit status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `if … | xargs -0 grep` read a match as clean whenever any one batch of files had none (xargs answers 123) or grep met an error (2). Today every file fits one batch, so nothing slipped through; it would once the repository grows. Same form as the server's and the CLI's check. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01H1bF3XAshtCGhF7TeLGcDk --- scripts/hygiene.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/hygiene.sh b/scripts/hygiene.sh index 8a9d92d..8de8d9f 100755 --- a/scripts/hygiene.sh +++ b/scripts/hygiene.sh @@ -20,7 +20,11 @@ patterns=( ) found=0 for pattern in "${patterns[@]}"; do - if git ls-files -z | grep -zv '^scripts/hygiene.sh$' | xargs -0 grep -nIEi -- "$pattern" ; then + # The output decides, not the exit status: xargs answers 123 when any one batch of files has no + # match, and grep 2 on an error -- either would have read as "clean" around real matches. + hits=$(git ls-files -z | grep -zv '^scripts/hygiene.sh$' | xargs -0 grep -nIEi -- "$pattern" 2>/dev/null || true) + if [ -n "$hits" ]; then + printf '%s\n' "$hits" echo "hygiene: the lines above match /$pattern/" >&2 found=1 fi