From: Krzysztof Mazur Date: Thu, 22 Nov 2012 18:12:08 +0000 (+0100) Subject: git-send-email: remove garbage after email address X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=831a488b76e0fcad68c6d1c7aaf9f086199e1738;p=git.git git-send-email: remove garbage after email address 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 #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 Tested-by: Felipe Balbi Signed-off-by: Junio C Hamano --- diff --git a/git-send-email.perl b/git-send-email.perl index 5a7c29db9..9840d0afc 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -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) {