git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3][V.2] git-send-email: Better handling of EOF [^D]

From
Michael Witten <mfwitten@mit.edu>
Date
Feb 4, 2008, 00:53 UTC
Message-ID
<1202086438-16251-3-git-send-email-mfwitten@mit.edu>
In-Reply-To
<1202086438-16251-2-git-send-email-mfwitten@mit.edu>

Before, when the user sent the EOF control character, the prompts would be repeated on the same line as the previous prompt.

Now, repeat prompts display on separate lines.
Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
 git-send-email.perl |   46 +++++++++++++++++++++++++++++-----------------
 1 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 14268fc..6724810 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -376,9 +376,12 @@ if (@files) {
 my $prompting = 0;
 if (!defined $sender) {
 	$sender = $repoauthor || $repocommitter;
-	do {
+
+	while (1) {
 		$_ = $term->readline("Who should the emails appear to be from? [$sender] ");
-	} while (!defined $_);
+		last if defined $_;
+		print "\n";
+	}
 
 	$sender = $_ if ($_);
 	print "Emails will be sent from: ", $sender, "\n";
@@ -386,10 +389,14 @@ if (!defined $sender) {
 }
 
 if (!@to) {
-	do {
-		$_ = $term->readline("Who should the emails be sent to? ",
-				"");
-	} while (!defined $_);
+
+
+	while (1) {
+		$_ = $term->readline("Who should the emails be sent to? ", "");
+		last if defined $_;
+		print "\n";
+	}
+
 	my $to = $_;
 	push @to, split /,/, $to;
 	$prompting++;
@@ -411,20 +418,23 @@ sub expand_aliases {
 @bcclist = expand_aliases(@bcclist);
 
 if (!defined $initial_subject && $compose) {
-	do {
-		$_ = $term->readline("What subject should the initial email start with? ",
-			$initial_subject);
-	} while (!defined $_);
+	while (1) {
+		$_ = $term->readline("What subject should the initial email start with? ", $initial_subject);
+		last if defined $_;
+		print "\n";
+	}
+
 	$initial_subject = $_;
 	$prompting++;
 }
 
 if ($thread && !defined $initial_reply_to && $prompting) {
-	do {
-		$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
-			$initial_reply_to);
-	} while (!defined $_);
-
+	while (1) {
+		$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ", $initial_reply_to);
+		last if defined $_;
+		print "\n";
+	}
+	
 	$initial_reply_to = $_;
 }
 if (defined $initial_reply_to && $_ ne "") {
@@ -474,9 +484,11 @@ EOT
 	close(C);
 	close(C2);
 
-	do {
+	while (1) {
 		$_ = $term->readline("Send this email? (y|n) ");
-	} while (!defined $_);
+		last if defined $_;
+		print "\n";
+	}
 
 	if (uc substr($_,0,1) ne 'Y') {
 		cleanup_compose_files();
-- 
1.5.4.9.gcc769-dirty
Previous: Michael Witten
Message 16 of 16 in “git-send-email: ssh/login style password requests”
  1. git-send-email: ssh/login style password requestsMichael Witten, Feb 1, 2008
  2. Junio C HamanoFeb 1, 2008
  3. Michael WittenFeb 1, 2008
  4. Michael WittenFeb 1, 2008
  5. Junio C HamanoFeb 1, 2008
  6. Michael WittenFeb 1, 2008
  7. Junio C HamanoFeb 2, 2008
  8. 1/2 [Perlers?] git-send-email: ssh/login style password requestsMichael Witten, Feb 2, 2008
  9. 2/2 [Perlers?] git-send-email: SIG{TERM,INT} handlersMichael Witten, Feb 2, 2008
  10. Junio C HamanoFeb 2, 2008
  11. Junio C HamanoFeb 2, 2008
  12. Michael WittenFeb 3, 2008
  13. Michael WittenFeb 3, 2008
  14. 1/3 [V.2] git-send-email: ssh/login style password requestsMichael Witten, Feb 4, 2008
  15. 2/3 [V.2] git-send-email: SIG{TERM,INT} handlersMichael Witten, Feb 4, 2008
  16. 3/3 [V.2] git-send-email: Better handling of EOF [^D]Michael Witten, Feb 4, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.