Skip to contentSkip to conversation

Understand the meaning of commas in git-send-email

PATCH In review Matthew Wilcox 2 participants 2 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Understand the meaning of commas in git-send-email

I made the mistake of adding one Cc: line with two email addresses on it, instead of two Cc: lines with one email address each. Extending git-send-email to parse that case turns out to not be too much work.

git-send-email.perl renamed from usr/bin/git-send-email +9 -7
@@ -537,13 +542,15 @@
 	my @emails;
 
 	foreach my $entry (@_) {
-		if (my $clean = extract_valid_address($entry)) {
-			$seen{$clean} ||= 0;
-			next if $seen{$clean}++;
-			push @emails, $entry;
-		} else {
-			print STDERR "W: unable to extract a valid address",
-					" from: $entry\n";
+		foreach my $addr (split(/, */, $entry)) {
+			if (my $clean = extract_valid_address($addr)) {
+				$seen{$clean} ||= 0;
+				next if $seen{$clean}++;
+				push @emails, $addr;
+			} else {
+				print STDERR "W: unable to extract a valid",
+					" address from: $entry\n";
+			}
 		}
 	}
 	return @emails;
#1 lore raw
Quoted 5 lines · Matthew Wilcox

I made the mistake of adding one Cc: line with two email addresses on it, instead of two Cc: lines with one email address each. Extending git-send-email to parse that case turns out to not be too much work.

I am not sure. The input addresses this part of the code deals with are of human readable form

Matthew Wilcox <[email protected]>
[email protected] (Matthew Wilcox)

and the loop is extracting the part inside <> pair.

I have a mild suspicion that your patch may need to understand quoting to handle somebody else's name safely and correctly.

[email protected] (Junio C Hamano, aka gitster)