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

[PATCH v5 3/3] send-email: separate the confirmation prompts from the messages

From
DSDragan Simic <dsimic@manjaro.org>
Date
Apr 7, 2024, 10:48 UTC
Message-ID
<7b99e5c7c0b0c8d3d7eaaae169e650ebe81964a1.1712486910.git.dsimic@manjaro.org>
In-Reply-To
<cover.1712486910.git.dsimic@manjaro.org>

Emit additional vertical whitespace after the "Send this email [y/n/...]?" confirmation prompts, more specifically after each confirmed email is sent, but before the subsequent messages are emitted, to make the produced output more readable. The subsequent produced messages were bunched together with the confirmation prompts, as visible in the sample output excerpt below, which made discerning the outputs unnecessarily harder.

    ...
    Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): y
    OK. Log says:
    ...

The introduced changes don't emit additional vertical whitespace after the confirmation prompt if the user selects to skip sending the email they were asked about, or if the user selects to quit the procedure entirely. This follows the Git's general approach of not wasting the vertical screen space whenever reasonably possible.

The associated test, t9001, requires no updates to cover these changes.
Signed-off-by: Dragan Simic <dsimic@manjaro.org>
---
 git-send-email.perl | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/git-send-email.perl b/git-send-email.perl
index 4127fbe6b936..a09bc7fd6b96 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1510,6 +1510,7 @@ sub gen_header {
 sub send_message {
 	my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
 	my @recipients = @$recipients_ref;
+	my $prompt_separator = 0;
 
 	my @sendmail_parameters = ('-i', @recipients);
 	my $raw_from = $sender;
@@ -1556,6 +1557,7 @@ sub send_message {
 			$confirm = 'never';
 			$needs_separator = 1;
 		}
+		$prompt_separator = 1;
 	} else {
 		$needs_separator = 1;
 	}
@@ -1665,6 +1667,7 @@ sub send_message {
 		$smtp->dataend() or die $smtp->message;
 		$smtp->code =~ /250|200/ or die sprintf(__("Failed to send %s\n"), $subject).$smtp->message;
 	}
+	print "\n" if ($prompt_separator);
 	if ($quiet) {
 		printf($dry_run ? __("Dry-Sent %s\n") : __("Sent %s\n"), $subject);
 	} else {
Previous: Dragan SimicNext: Junio C Hamano
Message 6 of 10 in “send-email: make produced outputs more readable”
  1. 0/3 send-email: make produced outputs more readableDragan Simic, Apr 7, 2024
  2. 1/3 send-email: move newline character out of a translatable stringDragan Simic, Apr 7, 2024
  3. 2/3 send-email: make it easy to discern the messages for each patchDragan Simic, Apr 7, 2024
  4. Junio C HamanoApr 8, 2024
  5. Dragan SimicApr 9, 2024
  6. 3/3 send-email: separate the confirmation prompts from the messagesDragan Simic, Apr 7, 2024
  7. Junio C HamanoApr 8, 2024
  8. Dragan SimicApr 9, 2024
  9. Dragan SimicApr 10, 2024
  10. Dragan SimicApr 10, 2024

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.