check-whitespace: avoid alerts about upstream commits

Every once in a while, whitespace errors are introduced in Git for
Windows' rebases to newer Git versions, simply by virtue of integrating
upstream commits that do not follow upstream Git's own whitespace rule.
In Git v2.50.0-rc0, for example, 03f2915541a4 (xdiff: disable
cleanup_records heuristic with --minimal, 2025-04-29) introduced a
trailing space.

Arguably, non-actionable alerts are worse than no alerts at all, so
let's suppress those alerts that we cannot do anything about, anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2025-06-03 12:45:39 +02:00
parent d74db2d801
commit c5e15230f9

View File

@ -19,6 +19,7 @@ problems=()
commit=
commitText=
commitTextmd=
committerEmail=
goodParent=
if ! git rev-parse --quiet --verify "${baseCommit}"
@ -27,7 +28,7 @@ then
exit 1
fi
while read dash sha etc
while read dash email sha etc
do
case "${dash}" in
"---") # Line contains commit information.
@ -40,10 +41,14 @@ do
commit="${sha}"
commitText="${sha} ${etc}"
commitTextmd="[${sha}](${url}/commit/${sha}) ${etc}"
committerEmail="${email}"
;;
"")
;;
*) # Line contains whitespace error information for current commit.
# Quod licet Iovi non licet bovi
test gitster@pobox.com != "$committerEmail" || break
if test -n "${goodParent}"
then
problems+=("1) --- ${commitTextmd}")
@ -64,7 +69,7 @@ do
echo "${dash} ${sha} ${etc}"
;;
esac
done <<< "$(git log --check --pretty=format:"---% h% s" "${baseCommit}"..)"
done <<< "$(git log --check --pretty=format:"---% ce% h% s" "${baseCommit}"..)"
if test ${#problems[*]} -gt 0
then