Thread (6 messages) flat view 6 messages, 2 authors, 2016-06-15
DORMANTno replies REVIEWED: 1 (0M)

1 review trailer.

[PATCH 1/5] git-send-email: remove garbage after email address

From: Krzysztof Mazur <hidden>
Date: 2016-06-15 22:55:23
Subsystem: the rest · Maintainer: Linus Torvalds

In some cases it's very useful to add some additional information
after email in Cc-list, for instance:

"Cc: Stable kernel [off-list ref] #v3.4 v3.5 v3.6"

Currently the git refuses to add such invalid email to Cc-list,
when the Email::Valid perl module is available or just uses whole line
as the email address.

Now in sanitize_address() everything after the email address is
removed, so the resulting line is correct email address and Email::Valid
validates it correctly.

Signed-off-by: Krzysztof Mazur <redacted>
Tested-by: Felipe Balbi <redacted>
---
 git-send-email.perl | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/git-send-email.perl b/git-send-email.perl
index 5a7c29d..9840d0a 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) {
-- 
1.8.0.393.gcc9701d
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help