Skip to content

Commit 5c80afe

Browse files
Krzysztof Mazurgitster
authored andcommitted
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 <[email protected]> Suggested-by: Junio C Hamano <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e431225 commit 5c80afe

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

git-send-email.perl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,16 @@ sub extract_valid_address_or_die {
852852
sub validate_address {
853853
my $address = shift;
854854
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+
}
857865
}
858866
return $address;
859867
}

0 commit comments

Comments
 (0)