diff options
author | Eric Wong <normalperson@yhbt.net> | 2006-05-15 02:41:01 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-05-15 12:14:22 -0700 |
commit | db3106b274a75d5b9ea7f6fe1030b8528df7389b (patch) | |
tree | 13b2347fe0bbfb0547e8ace49e598abf7eea07c4 /git-send-email.perl | |
parent | aca7ad7628ce72afbd1d0d99778c9a5c9cac7a7a (diff) | |
download | git-db3106b274a75d5b9ea7f6fe1030b8528df7389b.tar.gz git-db3106b274a75d5b9ea7f6fe1030b8528df7389b.tar.xz |
send-email: quiet some warnings, reject invalid addresses
I'm not sure why we never actually rejected invalid addresses in
the first place. We just seemed to be using our email validity
checkers to kill duplicates.
Now we just drop invalid email addresses completely and warn
the user about it.
Since we support local sendmail, we'll also accept username-only
addresses.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-x | git-send-email.perl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index 0540e9375..312a4ea2a 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -307,6 +307,10 @@ our ($message_id, $cc, %mail, $subject, $reply_to, $message); sub extract_valid_address { my $address = shift; + + # check for a local address: + return $address if ($address =~ /^([\w\-]+)$/); + if ($have_email_valid) { return Email::Valid->address($address); } else { @@ -498,9 +502,14 @@ sub unique_email_list(@) { my @emails; foreach my $entry (@_) { - my $clean = extract_valid_address($entry); - next if $seen{$clean}++; - push @emails, $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"; + } } return @emails; } |