send-email: don't cc *-by lines with '-' prefix

Since commit ef0cc1df90f6b ("send-email: also pick up cc addresses from -by trailers") in git version 2.20, git send-email adds to cc list addresses from all *-by lines. As a side effect a line with '-Signed-off-by' is now also added to cc. This makes send-email pick lines from patches that remove patch files from the git repo. This is common in the Buildroot project that often removes (and adds) patch files that have 'Signed-off-by' in their patch description part. Consider only *-by lines that start with [a-z] (case insensitive) to avoid unrelated addresses in cc. Cc: Joe Perches <joe@perches.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Rasmus Villemoes <rv@rasmusvillemoes.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Baruch Siach committed Mar 16, 2019 at 21:26 UTC 9c545816befc7b38e7347beb85fab64840bd0a8f
1 file changed +1 -1
git-send-email.perl
+1 -1
@@ -1699,7 +1699,7 @@ sub process_file {
1699 # Now parse the message body
1700 while(<$fh>) {
1701 $message .= $_;
1702 - if (/^([a-z-]*-by|Cc): (.*)/i) {
1702 + if (/^([a-z][a-z-]*-by|Cc): (.*)/i) {
1703 chomp;
1704 my ($what, $c) = ($1, $2);
1705 # strip garbage for the address we'll use: