mirror of
https://github.com/containers/podman.git
synced 2026-05-30 03:19:01 -04:00
Since commitdef70012b9git-validation is only used to check if the commit subject is less than 90 characters. Drop the vendored git-validation Go tool and the .gitvalidation make target in favor of hack/commit-subject-check.sh. This removes a Go build dependency and a vendored tree from test/tools/ while keeping the same CI and local behavior. Note the now-removed GIT_CHECK_EXCLUDE was not used by gitvalidation since commitdef70012b9because it was not checking any specific files, just the commit subject lengths. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
34 lines
717 B
Bash
Executable File
34 lines
717 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Check that commit subject lines in a given range are non-empty and no
|
|
# longer than $MAX chars. Replaces the former `git-validation -run
|
|
# short-subject` check.
|
|
#
|
|
# Usage: hack/commit-subject-check.sh <git-range>
|
|
# e.g. hack/commit-subject-check.sh origin/main..HEAD
|
|
|
|
set -euo pipefail
|
|
|
|
MAX=90
|
|
|
|
if [[ $# -ne 1 ]]; then
|
|
echo "Usage: $0 <git-range>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
range=$1
|
|
rc=0
|
|
|
|
while IFS=$'\t' read -r sha subject; do
|
|
len=${#subject}
|
|
if [[ $len -eq 0 ]]; then
|
|
echo "$sha: empty commit subject" >&2
|
|
rc=1
|
|
elif [[ $len -ge $MAX ]]; then
|
|
echo "$sha: subject is $len chars (must be < $MAX): $subject" >&2
|
|
rc=1
|
|
fi
|
|
done < <(git log --no-merges --format='%H%x09%s' "$range")
|
|
|
|
exit $rc
|