summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-03-17 19:58:22 -0400
committerJunio C Hamano <gitster@pobox.com>2016-03-18 14:47:10 -0700
commita277d1efa35ea47ac473ed7e3d92fc6f1c04da7d (patch)
tree0fbf1af46761a793679a815f7f2de593dcc29136
parent937978e0f3e750d917768c77665d5f8cfbd802b6 (diff)
downloadgit-jk/send-email-rtrim-mailrc-alias.tar.gz
send-email: ignore trailing whitespace in mailrc alias filejk/send-email-rtrim-mailrc-alias
The regex for parsing mailrc considers everything after the second whitespace to be the email address, up to the end of the line. We have to include whitespace there, because you may have multiple space-separated addresses, each with their own internal quoting. But if there is trailing whitespace, we include that, too. This confuses quotewords() when we try to split the individual addresses, and we end up storing "undef" in our alias list. Later parts of the code then access that, generating perl warnings. Let's tweak our regex to throw away any trailing whitespace on each line. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xgit-send-email.perl2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index d356901348..c45b22a19a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -533,7 +533,7 @@ my %parse_alias = (
$aliases{$alias} = \@addr
}}},
mailrc => sub { my $fh = shift; while (<$fh>) {
- if (/^alias\s+(\S+)\s+(.*)$/) {
+ if (/^alias\s+(\S+)\s+(.*?)\s*$/) {
# spaces delimit multiple addresses
$aliases{$1} = [ quotewords('\s+', 0, $2) ];
}}},