From 58309b02a900aa3513060c1331cfc8e63ebfd25a Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 21 Apr 2026 18:49:17 +0200 Subject: [PATCH] Fix the check_for_fixups script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git's --grep option uses Basic Regular Expression syntax by default, which means that the `[^\n]*` didn't do what was intended; it means "any character except `\` or the literal letter `n`" — not "any character except newline." Besides, `^` matched any line start, not only the start of the entire message, so "any character except newline" would have been wrong anyway. Given this, the script matched commits that have WIP or DROPME in the body, which is not what we want. (The last commit of this branch is an example for that.) Fix this by listing only the subject lines and grepping them outside of git; this also lets us use a slightly simpler regex (we want to match WIP anywhere in the subject). --- scripts/check_for_fixups.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_for_fixups.sh b/scripts/check_for_fixups.sh index 3d5518360..d2e8cb08e 100755 --- a/scripts/check_for_fixups.sh +++ b/scripts/check_for_fixups.sh @@ -2,7 +2,7 @@ # We will have only done a shallow clone, so the git log will consist only of # commits on the current PR -commits=$(git log --grep='^fixup!' --grep='^squash!' --grep='^amend!' --grep='^[^\n]*WIP' --grep='^[^\n]*DROPME' --format="%h %s") +commits=$(git log --format="%h %s" | egrep '(^fixup!|^squash!|^amend!|WIP|DROPME)') if [ -z "$commits" ]; then echo "No fixup commits found."