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>
Krzysztof Mazur committed
Nov 22, 2012 at 19:12 UTC
5c80afed02e1a5ffa4c164e8810aca8c8d655701
1 file changed
+10
-2
git-send-email.perl
+10
-2
@@ -852,8 +852,16 @@ sub extract_valid_address_or_die {
852
sub validate_address {
853
my $address = shift;
854
if (!extract_valid_address($address)) {
855
- print STDERR "W: unable to extract a valid address from: $address\n";
856
- return undef;
855
+ print STDERR "error: unable to extract a valid address from: $address\n";
856
+ $_ = ask("What to do with this address? ([q]uit|[d]rop): ",
857
+ valid_re => qr/^(?:quit|q|drop|d)/i,
858
+ default => 'q');
859
+ if (/^d/i) {
860
+ return undef;
861
+ } elsif (/^q/i) {
862
+ cleanup_compose_files();
863
+ exit(0);
864
+ }
865
}
866
return $address;
867
}