find header lines near the end of commit messages
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 3 Feb 2011 18:54:01 +0000 (19:54 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 3 Feb 2011 18:55:42 +0000 (19:55 +0100)
git-grep-footer [new file with mode: 0755]

diff --git a/git-grep-footer b/git-grep-footer
new file mode 100755 (executable)
index 0000000..026f5bc
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+git log --pretty=%b%x00 "$@" |
+perl -n0 -wMstrict -E '
+       for (reverse split /\n\n/) {
+               my @headers = grep m{
+                       ^ (?: [a-z]+ (?: (?:-\w+)+ | \ by ) ) : \s* \S
+               }imx, split /\n/ or next;
+               say for @headers;
+               last;
+       }
+'