diff options
author | Robin Jarry <robin@jarry.cc> | 2023-02-28 12:45:57 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-02-28 12:47:39 +0100 |
commit | 8e70c7d40c62ae32463d1ff766b40a5e371bf2aa (patch) | |
tree | cd45588a5a4534b2038cfd25752a4cbadda17b3d /contrib | |
parent | c29d08808986dbf19df498b9ee9c4887146266dc (diff) | |
download | aerc-8e70c7d40c62ae32463d1ff766b40a5e371bf2aa.tar.gz |
check-patches: report all errors
Instead of skipping to the next patch after the first error, report all
issues. Change the output to make it more user friendly.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/check-patches | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/contrib/check-patches b/contrib/check-patches index 7d171b53..20291eb6 100755 --- a/contrib/check-patches +++ b/contrib/check-patches @@ -4,35 +4,39 @@ set -e revision_range="${1?revision range}" -total=0 valid=0 +total=$(git rev-list --reverse "$revision_range" | wc -l) +if [ "$total" -eq 0 ]; then + exit 0 +fi +n=0 for rev in $(git rev-list --reverse "$revision_range"); do - total=$((total + 1)) + n=$((n + 1)) title=$(git log --format='%s' -1 "$rev") + fail=false author=$(git log --format='%an <%ae>' -1 "$rev") - git log --format="%(trailers:key=Signed-off-by,only,valueonly)" -1 "$rev" | - grep -qFx "$author" || { - echo "error: '$title' 'Signed-off-by: $author' trailer is missing" >&2 - continue - } + if ! git log --format="%(trailers:key=Signed-off-by,only,valueonly)" -1 "$rev" | + grep -qFx "$author"; then + echo "error [PATCH $n/$total] '$title' 'Signed-off-by: $author' trailer is missing" >&2 + fail=true + fi body=$(git log --format='%b' -1 "$rev") body=${body%$(git log --format='%(trailers)' -1 "$rev")} if [ "$(echo "$body" | wc -w)" -lt 3 ]; then - echo "error: '$title' body has less than three words, please elaborate" >&2 - continue + echo "error [PATCH $n/$total] '$title' body has less than three words, please elaborate" >&2 + fail=true fi - echo "ok: '$title'" + if [ "$fail" = true ]; then + continue + fi + echo "ok [PATCH $n/$total] '$title'" valid=$((valid + 1)) done -if [ "$total" -eq 0 ]; then - exit 0 -fi - echo "$valid/$total valid patches" if [ "$valid" -ne "$total" ]; then exit 1 |