Skip to content

Commit

Permalink
git-send-email: remove garbage after email address
Browse files Browse the repository at this point in the history
In some cases it is useful to add additional information after the
email address on the Cc: footer in a commit log, for instance:

"Cc: Stable kernel <stable@vger.kernel.org> #v3.4 v3.5 v3.6"

However, git-send-email refuses to pick up such an invalid address
when the Email::Valid perl module is available, or just uses the
whole line as the email address.

In sanitize_address(), remove everything after the email address, so
that the result is a valid email address that makes Email::Valid
happy.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Krzysztof Mazur authored and Junio C Hamano committed Nov 26, 2012
1 parent e8a1f5a commit 831a488
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,10 @@ sub quote_subject {
# use the simplest quoting being able to handle the recipient
sub sanitize_address {
my ($recipient) = @_;

# remove garbage after email address
$recipient =~ s/(.*>).*$/$1/;

my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\s*(<.*)/);

if (not $recipient_name) {
Expand Down

0 comments on commit 831a488

Please sign in to comment.