Thread (6 messages) flat view 6 messages, 2 authors, 2016-06-15
DORMANTno replies

[PATCH 4/5] git-send-email: ask what to do with an invalid email address

From: Krzysztof Mazur <hidden>
Date: 2016-06-15 22:55:23
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
Suggested-by: Junio C Hamano <redacted>
---
 git-send-email.perl | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 5056fdc..d42dca2 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -852,8 +852,16 @@ sub extract_valid_address_or_die {
 sub validate_address {
 	my $address = shift;
 	if (!extract_valid_address($address)) {
-		print STDERR "W: unable to extract a valid address from: $address\n";
-		return undef;
+		print STDERR "error: unable to extract a valid address from: $address\n";
+		$_ = 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;
 }
-- 
1.8.0.393.gcc9701d
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help