Make three fail-open lints fail loudly

check-attribution-trailers.sh: the origin/main fallback now fails
loudly if it cannot fetch/resolve origin/main, instead of silently
substituting HEAD~10 as the diff base.

check-comment-blocks.sh and check-issue-refs.sh: assert the tracked
file-list search matched at least one file before treating an empty
hit-set as clean, mirroring the existing assertion in
check-doc-refs.sh.

Refs 4442, fixes 4439
This commit is contained in:
atlas 2026-09-16 18:03:00 +02:00
commit dc0924627a
3 changed files with 24 additions and 1 deletions

View file

@ -28,7 +28,10 @@ if ! git rev-parse --verify "$base" >/dev/null 2>&1; then
git fetch origin "$branch" 2>/dev/null || true
if ! git rev-parse --verify "$base" >/dev/null 2>&1; then
base="origin/main"
git fetch origin main 2>/dev/null || base="HEAD~10"
if ! git fetch origin main 2>/dev/null || ! git rev-parse --verify "$base" >/dev/null 2>&1; then
echo 'check-attribution-trailers: base ref unresolvable — cannot fetch origin/main to diff against, refusing to guess a commit range' >&2
exit 1
fi
fi
fi