Message ID | e3212c0a4ad331685c68c13afcdbced20982ab32.1712364420.git.dsimic@manjaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v3] send-email: make it easy to discern the messages for each patch | expand |
Dragan Simic <dsimic@manjaro.org> writes: > As the final touch, make the above-mentioned prompt emitted without using > underlined text, which also applies to any other produced prompts, which made > them somewhat hard on the eyes, especially because the prompt's tailing space > character was also underlined. Don't do this, or at least don't do this in the same patch. Another lesson to learn: resist temptation to grow the scope of the topic. Especially with ascetics, your preference may not be shared by other users, which would easily hold up the main part of the patch you wanted to improve and the reviewers have already spent effort on to polish to be ready. Also are you sure in everybody's environment that ->ornaments() call is available and effective? That is another thing that can hold up the rest of this change. Don't waste your effort so far and build it as a follow-up patch and do so after the dust settles. Thanks.
On 2024-04-06 03:12, Junio C Hamano wrote: > Dragan Simic <dsimic@manjaro.org> writes: > >> As the final touch, make the above-mentioned prompt emitted without >> using >> underlined text, which also applies to any other produced prompts, >> which made >> them somewhat hard on the eyes, especially because the prompt's >> tailing space >> character was also underlined. > > Don't do this, or at least don't do this in the same patch. > > Another lesson to learn: resist temptation to grow the scope of the > topic. Especially with ascetics, your preference may not be shared > by other users, which would easily hold up the main part of the > patch you wanted to improve and the reviewers have already spent > effort on to polish to be ready. So many lessons to learn. :) Makes sense, here comes the v4, and an additional follow-up patch. > Also are you sure in everybody's > environment that ->ornaments() call is available and effective? > That is another thing that can hold up the rest of this change. > Don't waste your effort so far and build it as a follow-up patch > and do so after the dust settles. According to my research, the "->ornaments(0)" call should work in all environments as expected. It's also officially documented. [1] [1] https://perldoc.perl.org/Term::ReadLine#ornaments
Dragan Simic <dsimic@manjaro.org> writes: > According to my research, the "->ornaments(0)" call should work in > all environments as expected. It's also officially documented. [1] > > [1] https://perldoc.perl.org/Term::ReadLine#ornaments Go back to the DESCRIPTION section and realize that it is a front-end for different implementations. The functions are listed in separate sections, the first section being "Minimal set of supported functions", the other one being "Additional" that may or may not be available/effective for everybody. Which side does ornaments fall in that page?
On 2024-04-06 03:30, Junio C Hamano wrote: > Dragan Simic <dsimic@manjaro.org> writes: > >> According to my research, the "->ornaments(0)" call should work in >> all environments as expected. It's also officially documented. [1] >> >> [1] https://perldoc.perl.org/Term::ReadLine#ornaments > > Go back to the DESCRIPTION section and realize that it is a > front-end for different implementations. The functions are listed > in separate sections, the first section being "Minimal set of > supported functions", the other one being "Additional" that may or > may not be available/effective for everybody. Which side does > ornaments fall in that page? Well spotted, thanks. Perhaps it's the best to leave the prompts as-is until I spend some time to cover the possible Perl platform and package differences properly. Furthermore, it would be useful to add some color coding to the produced outputs, so the failures and successes could be spotted even more easily, but that's perhaps a can of worms that's best if left unopened.
diff --git a/git-send-email.perl b/git-send-email.perl index 821b2b3a135a..d445c22026df 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -212,6 +212,7 @@ sub format_2822_time { my $compose_filename; my $force = 0; my $dump_aliases = 0; +my $needs_separator = 0; # Variables to prevent short format-patch options from being captured # as abbreviated send-email options @@ -936,6 +937,7 @@ sub get_patch_subject { $term = $ENV{"GIT_SEND_EMAIL_NOTTY"} ? Term::ReadLine->new('git-send-email', \*STDIN, \*STDOUT) : Term::ReadLine->new('git-send-email'); + $term->ornaments(0); } return $term; } @@ -1361,7 +1363,6 @@ sub smtp_host_string { # Returns 1 if authentication succeeded or was not necessary # (smtp_user was not specified), and 0 otherwise. - sub smtp_auth_maybe { if (!defined $smtp_authuser || $auth || (defined $smtp_auth && $smtp_auth eq "none")) { return 1; @@ -1510,6 +1511,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; @@ -1554,7 +1556,11 @@ sub send_message { exit(0); } elsif (/^a/i) { $confirm = 'never'; + $needs_separator = 1; } + $prompt_separator = 1; + } else { + $needs_separator = 1; } unshift (@sendmail_parameters, @smtp_server_options); @@ -1576,7 +1582,6 @@ sub send_message { print $sm "$header\n$message"; close $sm or die $!; } else { - if (!defined $smtp_server) { die __("The required SMTP server is not properly defined.") } @@ -1663,6 +1668,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 { @@ -1686,10 +1692,11 @@ sub send_message { print $header, "\n"; if ($smtp) { print __("Result: "), $smtp->code, ' ', - ($smtp->message =~ /\n([^\n]+\n)$/s), "\n"; + ($smtp->message =~ /\n([^\n]+\n)$/s); } else { - print __("Result: OK\n"); + print __("Result: OK"); } + print "\n"; } return 1; @@ -1920,7 +1927,8 @@ sub pre_process_file { sub process_file { my ($t) = @_; - pre_process_file($t, $quiet); + pre_process_file($t, $quiet); + print "\n" if ($needs_separator); my $message_was_sent = send_message(); if ($message_was_sent == -1) {