[RFC 1/4] devtools: use git trailer parser for tag extraction
Stephen Hemminger
stephen at networkplumber.org
Thu Apr 2 18:16:06 CEST 2026
Replace the grep of the commit body for trailer-like lines with
git log --format="%(trailers:unfold)". This uses the same parsing
logic as git-interpret-trailers(1), so the definition of "what is
a trailer" matches what git itself understands.
The hand-rolled pattern (grep -i -e "by *:" -e "fix.*:") could
both miss valid trailers and match non-trailer lines in the body.
The %(trailers) format specifier has been available since Git 2.11
(November 2016).
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
devtools/check-git-log.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/devtools/check-git-log.sh b/devtools/check-git-log.sh
index 45a58fab4f..1e04bca01b 100755
--- a/devtools/check-git-log.sh
+++ b/devtools/check-git-log.sh
@@ -52,7 +52,9 @@ headlines=$(git log --format='%s' --reverse $range)
bodylines=$(git log --format='%b' --reverse $range)
fixes=$(git log --format='%h %s' --reverse $range | grep -i ': *fix' | cut -d' ' -f1)
stablefixes=$($selfdir/git-log-fixes.sh $range | sed '/(N\/A)$/d' | cut -d' ' -f2)
-tags=$(git log --format='%b' --reverse $range | grep -i -e 'by *:' -e 'fix.*:')
+# Use git's own trailer parser rather than hand-rolled regex.
+# %(trailers:unfold) gives us exactly what git-interpret-trailers --parse sees.
+tags=$(git log --format='%(trailers:unfold)' --reverse $range | grep -v '^$')
bytag='\(Reported\|Suggested\|Signed-off\|Acked\|Reviewed\|Tested\)-by:'
reltag='Coverity issue:\|Bugzilla ID:\|Fixes:\|Cc:'
--
2.53.0
More information about the dev
mailing list