Skip to content

Commit 831a488

Browse files
Krzysztof Mazurgitster
authored andcommitted
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 <[email protected]> #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 <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e8a1f5a commit 831a488

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

git-send-email.perl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,10 @@ sub quote_subject {
924924
# use the simplest quoting being able to handle the recipient
925925
sub sanitize_address {
926926
my ($recipient) = @_;
927+
928+
# remove garbage after email address
929+
$recipient =~ s/(.*>).*$/$1/;
930+
927931
my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\s*(<.*)/);
928932

929933
if (not $recipient_name) {

0 commit comments

Comments
 (0)