git-send-email: ask what to do with an invalid email address

We used to warn about invalid emails and just drop them. Such warnings
can be unnoticed by user or noticed after sending email when we are not
giving the "final sanity check [Y/n]?"

Now we quit by default.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Krzysztof Mazur 2012-11-22 19:12:11 +01:00 committed by Junio C Hamano
parent e431225569
commit 5c80afed02

View File

@ -852,8 +852,16 @@ sub extract_valid_address_or_die {
sub validate_address { sub validate_address {
my $address = shift; my $address = shift;
if (!extract_valid_address($address)) { if (!extract_valid_address($address)) {
print STDERR "W: unable to extract a valid address from: $address\n"; print STDERR "error: unable to extract a valid address from: $address\n";
return undef; $_ = ask("What to do with this address? ([q]uit|[d]rop): ",
valid_re => qr/^(?:quit|q|drop|d)/i,
default => 'q');
if (/^d/i) {
return undef;
} elsif (/^q/i) {
cleanup_compose_files();
exit(0);
}
} }
return $address; return $address;
} }