I hope this will do it!
PATCH 1/1 I hope this will do it!
Here is the list of notable improvements:
send-email: --compose takes optional argument to existing file
* Update docs about what editor is chosen.
* Better variable name for --compose paths and filehandles.
* Abort on empty summary.
* Note (in commit message) that editing the final version no longer is used.
send-email: Minor cleanup of $smtp_server usage and send_message()
* Back to localhost.
* Add note about empty string if it's not already there.
send-email: Add --sleep for email throttling
* Put docs in alphabetical order.
send-email: Remove horrible mix of tabs and spaces
* Less verbose whitespace comment.
send-email: References: should only reference what is actually sent
* s/of/if/ (comment above send_message()).
send-email: Handle "GIT:" rather than "GIT: " during --compose
* Undo refactoring of get_patch_subject().
send-email: --smtp-server-port should take an integer
* Update documents to suggest that symbolic ports can be used.
* Put this commit with the docs.
send-email: Cleanup the usage text and docs a bit
* Add note about symbolic ports
Docs: send-email: Remove superfluous information in CONFIGURATION
* Remove comment block?
Docs: send-email: Put options back into alphabetical order
* Remove comment block?
The overall diffstat:
Documentation/git-send-email.txt | 129 ++++++--- git-send-email.perl | 641 +++++++++++++++++++++++++------------- 2 files changed, 511 insertions(+), 259 deletions(-)
The overall patch series:
[PATCH RFC3 01/13] Docs: send-email: Put options back into alphabetical order
new [PATCH RFC3 02/13] Docs: send-email: Refer to CONFIGURATION section for sendemail.multiedit
[PATCH RFC3 03/13] Docs: send-email: Remove superfluous information in CONFIGURATION [PATCH RFC3 04/13] Docs: send-email: --smtp-server-port can take symbolic ports [PATCH RFC3 05/13] send-email: Cleanup the usage text and docs a bit
[PATCH RFC3 06/13] send-email: Handle "GIT:" rather than "GIT: " during --compose [PATCH RFC3 07/13] send-email: 'References:' should only reference what is sent
new [PATCH RFC3 08/13] send-email: Remove superfluous `my $editor = ...'
[PATCH RFC3 09/13] send-email: Remove horrible mix of tabs and spaces
[PATCH RFC3 10/13] send-email: Add --sleep for email throttling
[PATCH RFC3 11/13] send-email: Minor cleanup of $smtp_server usage and send_message() [PATCH RFC3 12/13] send-email: --compose takes optional argument to existing file
new [PATCH RFC3 13/13] send-email: --compose always includes a 'GIT: ' prefixed list of patch subjects
Sincerely,
Michael Witten
PATCH 1/13 Docs: send-email: Put options back into alphabetical order
--- Documentation/git-send-email.txt | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)
Documentation/git-send-email.txt +11 -11
@@ -39,6 +39,11 @@ OPTIONS Composing ~~~~~~~~~ +--annotate:: + Review each patch you're about to send in an editor. The setting + 'sendemail.multiedit' defines if this will spawn one editor per patch + or one for all of them at once. + --bcc=<address>:: Specify a "Bcc:" value for each email. Default is the value of 'sendemail.bcc'.
@@ -51,11 +56,6 @@ The --bcc option must be repeated for each user you want on the bcc list. + The --cc option must be repeated for each user you want on the cc list. ---annotate:: - Review each patch you're about to send in an editor. The setting - 'sendemail.multiedit' defines if this will spawn one editor per patch - or one for all of them at once. - --compose:: Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an introductory message for the patch series.
@@ -230,6 +230,12 @@ have been specified, in which case default to 'compose'. --dry-run:: Do everything except actually send the emails. +--[no-]format-patch:: + When an argument may be understood either as a reference or as a file name, + choose to understand it as a format-patch argument ('--format-patch') + or as a file name ('--no-format-patch'). By default, when such a conflict + occurs, git send-email will fail. + --quiet:: Make git-send-email less verbose. One line per email should be all that is output.
@@ -246,12 +252,6 @@ have been specified, in which case default to 'compose'. Default is the value of 'sendemail.validate'; if this is not set, default to '--validate'. ---[no-]format-patch:: - When an argument may be understood either as a reference or as a file name, - choose to understand it as a format-patch argument ('--format-patch') - or as a file name ('--no-format-patch'). By default, when such a conflict - occurs, git send-email will fail. - CONFIGURATION -------------
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 2/13 Docs: send-email: Refer to CONFIGURATION section for sendemail.multiedit
Replace description of sendemail.multiedit in --annotate docs with a reference to the CONFIGURATION section.
Add such a reference to the --compose documentation.
--- Documentation/git-send-email.txt | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
Documentation/git-send-email.txt +4 -3
@@ -40,9 +40,8 @@ Composing ~~~~~~~~~ --annotate:: - Review each patch you're about to send in an editor. The setting - 'sendemail.multiedit' defines if this will spawn one editor per patch - or one for all of them at once. + Review and edit each patch you're about to send. See the + CONFIGURATION section for 'sendemail.multiedit'. --bcc=<address>:: Specify a "Bcc:" value for each email. Default is the value of
@@ -67,6 +66,8 @@ In-Reply-To headers specified in the message. If the body of the message and In-Reply-To headers will be used unless they are removed. + Missing From or In-Reply-To headers will be prompted for. ++ +See the CONFIGURATION section for 'sendemail.multiedit'. --from=<address>:: Specify the sender of the emails. This will default to
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 3/13 Docs: send-email: Remove superfluous information in CONFIGURATION
In particular, sendemail.confirm was removed, because it's already described along with its corresponding option.
--- Documentation/git-send-email.txt | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
Documentation/git-send-email.txt +0 -6
@@ -271,12 +271,6 @@ sendemail.multiedit:: summary when '--compose' is used). If false, files will be edited one after the other, spawning a new editor each time. -sendemail.confirm:: - Sets the default for whether to confirm before sending. Must be - one of 'always', 'never', 'cc', 'compose', or 'auto'. See '--confirm' - in the previous section for the meaning of these values. - - Author ------ Written by Ryan Anderson <[email protected]>
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 4/13 Docs: send-email: --smtp-server-port can take symbolic ports
--- Documentation/git-send-email.txt | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
Documentation/git-send-email.txt +3 -1
@@ -136,7 +136,9 @@ user is prompted for a password while the input is masked for privacy. --smtp-server-port=<port>:: Specifies a port different from the default port (SMTP servers typically listen to smtp port 25 and ssmtp port - 465). This can be set with 'sendemail.smtpserverport'. + 465); symbolic port names are allowed. The port can also + be set with the 'sendemail.smtpserverport' configuration + variable. --smtp-ssl:: Legacy alias for '--smtp-encryption ssl'.
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 5/13 send-email: Cleanup the usage text and docs a bit
All usage text lines should be < 80 characters.
A port number in --smtp-server is no longer handled, so the suggestion has been removed.
--chain-reply-to doesn't take an argument.
The here-document quotation that defines the usage text is now a single-quote form, so that no interpolation takes place.
--- Documentation/git-send-email.txt | 17 +++++++------ git-send-email.perl | 49 +++++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 30 deletions(-)
Documentation/git-send-email.txt +9 -8
@@ -74,8 +74,9 @@ See the CONFIGURATION section for 'sendemail.multiedit'. the value GIT_COMMITTER_IDENT, as returned by "git var -l". The user will still be prompted to confirm this entry. ---in-reply-to=<identifier>:: - Specify the contents of the first In-Reply-To header. +--in-reply-to=<message-id>:: + Specify the contents of the first In-Reply-To header; + include the angle brackets '<' and '>'. Subsequent emails will refer to the previous email instead of this if --chain-reply-to is set (the default) Only necessary if --compose is also set. If --compose
@@ -106,7 +107,7 @@ Sending the 'sendemail.envelopesender' configuration variable; if that is unspecified, choosing the envelope sender is left to your MTA. ---smtp-encryption=<encryption>:: +--smtp-encryption=<type>:: Specify the encryption to use, either 'ssl' or 'tls'. Any other value reverts to plain SMTP. Default is the value of 'sendemail.smtpencryption'.
@@ -158,7 +159,7 @@ Automating Output of this command must be single email address per line. Default is the value of 'sendemail.cccmd' configuration value. ---[no-]chain-reply-to=<identifier>:: +--[no-]chain-reply-to:: If this is set, each email will be sent as a reply to the previous email sent. If disabled with "--no-chain-reply-to", all emails after the first will be sent as replies to the first email sent. When using
@@ -166,11 +167,11 @@ Automating entire patch series. Default is the value of the 'sendemail.chainreplyto' configuration value; if that is unspecified, default to --chain-reply-to. ---identity=<identity>:: +--identity=<id>:: A configuration identity. When given, causes values in the - 'sendemail.<identity>' subsection to take precedence over + 'sendemail.<id>' subsection to take precedence over values in the 'sendemail' section. The default identity is - the value of 'sendemail.identity'. + the value of the 'sendemail.identity' configuration variable. --[no-]signed-off-by-cc:: If this is set, add emails found in Signed-off-by: or Cc: lines to the
@@ -214,7 +215,7 @@ specified, as well as 'body' if --no-signed-off-cc is specified. Administering ~~~~~~~~~~~~~ ---confirm=<mode>:: +--confirm=<when>:: Confirm just before sending: + --
git-send-email.perl +27 -22
73 lines not on this page · raw message
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 6/13 send-email: Handle "GIT:" rather than "GIT: " during --compose
This should make things a little more robust in terms of user input; before, even the program got it wrong by outputting a line with only "GIT:", which was left in place as a header, because there would be no following space character.
--- git-send-email.perl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
git-send-email.perl +2 -2
@@ -534,7 +534,7 @@ if ($compose) { print C <<EOT; From $tpl_sender # This line is ignored. -GIT: Lines beginning in "GIT: " will be removed. +GIT: Lines beginning in "GIT:" will be removed. GIT: Consider including an overall diffstat or table of contents GIT: for the patch you are writing. GIT:
@@ -567,7 +567,7 @@ EOT my $in_body = 0; my $summary_empty = 1; while(<C>) { - next if m/^GIT: /; + next if m/^GIT:/; if ($in_body) { $summary_empty = 0 unless (/^\n$/); } elsif (/^\n$/) {
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 7/13 send-email: 'References:' should only reference what is sent
If someone responded with a negative (n|no) to the confirmation, then the Message-ID of the discarded email is no longer used in the References: header of subsequent emails.
Consequently, send_message() now returns 1 if the message was sent and 0 otherwise.
--- git-send-email.perl | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)
git-send-email.perl +10 -4
@@ -801,6 +801,10 @@ sub sanitize_address } +# Returns 1 if the message was sent, and 0 otherwise. +# In actuality, the whole program dies when a there +# is an error sending a message. + sub send_message { my @recipients = unique_email_list(@to);
@@ -869,7 +873,7 @@ X-Mailer: git-send-email $gitversion default => $ask_default); die "Send this email reply required" unless defined $_; if (/^n/i) { - return; + return 0; } elsif (/^q/i) { cleanup_compose_files(); exit(0);
@@ -950,7 +954,7 @@ X-Mailer: git-send-email $gitversion $smtp->data or die $smtp->message; $smtp->datasend("$header\n$message") or die $smtp->message; $smtp->dataend() or die $smtp->message; - $smtp->ok or die "Failed to send $subject\n".$smtp->message; + $smtp->code =~ /250|200/ or die "Failed to send $subject\n".$smtp->message; } if ($quiet) { printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
@@ -971,6 +975,8 @@ X-Mailer: git-send-email $gitversion print "Result: OK\n"; } } + + return 1; } $reply_to = $initial_reply_to;
@@ -1131,10 +1137,10 @@ foreach my $t (@files) { @cc = (@initial_cc, @cc); - send_message(); + my $message_was_sent = send_message(); # set up for the next message - if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) { + if ($message_was_sent and $chain_reply_to || not defined $reply_to || length($reply_to) == 0) { $reply_to = $message_id; if (length $references > 0) { $references .= "\n $message_id";
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 8/13 send-email: Remove superfluous `my $editor = ...'
Not only was it a repeat, but it also had no effect.
--- git-send-email.perl | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
git-send-email.perl +0 -2
@@ -549,8 +549,6 @@ EOT } close(C); - my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi"; - if ($annotate) { do_edit($compose_filename, @files); } else {
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 9/13 send-email: Remove horrible mix of tabs and spaces
For the most part, I ran a search for all the lines that match:
^[\t]*[ ]+
and then I manually replaced the offending text with an appropriate number of tabs.
While scanning through the file, I also tried to format some of the code so as to obviate future mixing; I also fixed one horrendously egregious section of code, where someone was trying to be unnecessarily compact.
Currently, no lines match the following:
[\t]+[ ]+
[ ]+[\t]+So, it should be reasonably clean.
The whole file is still horrendous.
--- git-send-email.perl | 273 ++++++++++++++++++++++++++++++--------------------- 1 files changed, 163 insertions(+), 110 deletions(-)
git-send-email.perl +163 -110
@@ -16,6 +16,9 @@ # and second line is the subject of the message. # +# Please do not mix tabs spaces across lines that share a relationship +# in terms of layout. Currently, all indentation is expected to use tabs. + use strict; use warnings; use Term::ReadLine;
@@ -116,19 +119,20 @@ sub format_2822_time { die ("local time offset greater than or equal to 24 hours\n"); } - return sprintf("%s, %2d %s %d %02d:%02d:%02d %s%02d%02d", - qw(Sun Mon Tue Wed Thu Fri Sat)[$localtm[6]], - $localtm[3], - qw(Jan Feb Mar Apr May Jun - Jul Aug Sep Oct Nov Dec)[$localtm[4]], - $localtm[5]+1900, - $localtm[2], - $localtm[1], - $localtm[0], - ($offset >= 0) ? '+' : '-', - abs($offhour), - $offmin, - ); + return sprintf( + "%s, %2d %s %d %02d:%02d:%02d %s%02d%02d", + qw(Sun Mon Tue Wed Thu Fri Sat)[$localtm[6]], + $localtm[3], + qw(Jan Feb Mar Apr May Jun + Jul Aug Sep Oct Nov Dec)[$localtm[4]], + $localtm[5]+1900, + $localtm[2], + $localtm[1], + $localtm[0], + ($offset >= 0) ? '+' : '-', + abs($offhour), + $offmin, + ); } my $have_email_valid = eval { require Email::Valid; 1 };
@@ -192,29 +196,29 @@ my ($validate, $confirm); my (@suppress_cc); my %config_bool_settings = ( - "thread" => [\$thread, 1], - "chainreplyto" => [\$chain_reply_to, 1], - "suppressfrom" => [\$suppress_from, undef], - "signedoffbycc" => [\$signed_off_by_cc, undef], - "signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated - "validate" => [\$validate, 1], + "thread" => [\$thread, 1], + "chainreplyto" => [\$chain_reply_to, 1], + "suppressfrom" => [\$suppress_from, undef], + "signedoffbycc" => [\$signed_off_by_cc, undef], + "signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated + "validate" => [\$validate, 1], ); my %config_settings = ( - "smtpserver" => \$smtp_server, - "smtpserverport" => \$smtp_server_port, - "smtpuser" => \$smtp_authuser, - "smtppass" => \$smtp_authpass, - "to" => \@to, - "cc" => \@initial_cc, - "cccmd" => \$cc_cmd, - "aliasfiletype" => \$aliasfiletype, - "bcc" => \@bcclist, - "aliasesfile" => \@alias_files, - "suppresscc" => \@suppress_cc, - "envelopesender" => \$envelope_sender, - "multiedit" => \$multiedit, - "confirm" => \$confirm, + "smtpserver" => \$smtp_server, + "smtpserverport" => \$smtp_server_port, + "smtpuser" => \$smtp_authuser, + "smtppass" => \$smtp_authpass, + "to" => \@to, + "cc" => \@initial_cc, + "cccmd" => \$cc_cmd, + "aliasfiletype" => \$aliasfiletype, + "bcc" => \@bcclist, + "aliasesfile" => \@alias_files, + "suppresscc" => \@suppress_cc, + "envelopesender" => \$envelope_sender, + "multiedit" => \$multiedit, + "confirm" => \$confirm, ); # Handle Uncouth Termination
@@ -245,37 +249,38 @@ $SIG{INT} = \&signal_handler; # Begin by accumulating all the variables (defined above), that we will end up # needing, first, from the command line: -my $rc = GetOptions("sender|from=s" => \$sender, - "in-reply-to=s" => \$initial_reply_to, - "subject=s" => \$initial_subject, - "to=s" => \@to, - "cc=s" => \@initial_cc, - "bcc=s" => \@bcclist, - "chain-reply-to!" => \$chain_reply_to, - "smtp-server=s" => \$smtp_server, - "smtp-server-port=s" => \$smtp_server_port, - "smtp-user=s" => \$smtp_authuser, - "smtp-pass:s" => \$smtp_authpass, - "smtp-ssl" => sub { $smtp_encryption = 'ssl' }, - "smtp-encryption=s" => \$smtp_encryption, - "identity=s" => \$identity, - "annotate" => \$annotate, - "compose" => \$compose, - "quiet" => \$quiet, - "cc-cmd=s" => \$cc_cmd, - "suppress-from!" => \$suppress_from, - "suppress-cc=s" => \@suppress_cc, - "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc, - "confirm=s" => \$confirm, - "dry-run" => \$dry_run, - "envelope-sender=s" => \$envelope_sender, - "thread!" => \$thread, - "validate!" => \$validate, - "format-patch!" => \$format_patch, - ); +my $rc = GetOptions( + "sender|from=s" => \$sender, + "in-reply-to=s" => \$initial_reply_to, + "subject=s" => \$initial_subject, + "to=s" => \@to, + "cc=s" => \@initial_cc, + "bcc=s" => \@bcclist, + "chain-reply-to!" => \$chain_reply_to, + "smtp-server=s" => \$smtp_server, + "smtp-server-port=s" => \$smtp_server_port, + "smtp-user=s" => \$smtp_authuser, + "smtp-pass:s" => \$smtp_authpass, + "smtp-ssl" => sub { $smtp_encryption = 'ssl' }, + "smtp-encryption=s" => \$smtp_encryption, + "identity=s" => \$identity, + "annotate" => \$annotate, + "compose" => \$compose, + "quiet" => \$quiet, + "cc-cmd=s" => \$cc_cmd, + "suppress-from!" => \$suppress_from, + "suppress-cc=s" => \@suppress_cc, + "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc, + "confirm=s" => \$confirm, + "dry-run" => \$dry_run, + "envelope-sender=s" => \$envelope_sender, + "thread!" => \$thread, + "validate!" => \$validate, + "format-patch!" => \$format_patch, +); unless ($rc) { - usage(); + usage(); } die "Cannot run git format-patch from outside a repository\n"
@@ -404,29 +409,55 @@ sub split_addrs { my %aliases; my %parse_alias = ( # multiline formats can be supported in the future - mutt => sub { my $fh = shift; while (<$fh>) { - if (/^\s*alias\s+(\S+)\s+(.*)$/) { - my ($alias, $addr) = ($1, $2); - $addr =~ s/#.*$//; # mutt allows # comments - # commas delimit multiple addresses - $aliases{$alias} = [ split_addrs($addr) ]; - }}}, - mailrc => sub { my $fh = shift; while (<$fh>) { - if (/^alias\s+(\S+)\s+(.*)$/) { - # spaces delimit multiple addresses - $aliases{$1} = [ split(/\s+/, $2) ]; - }}}, - pine => sub { my $fh = shift; my $f='\t[^\t]*'; - for (my $x = ''; defined($x); $x = $_) { + mutt => sub { + + my $fh = shift; + + while (<$fh>) { + if (/^\s*alias\s+(\S+)\s+(.*)$/) { + my ($alias, $addr) = ($1, $2); + $addr =~ s/#.*$//; # mutt allows # comments + # commas delimit multiple addresses + $aliases{$alias} = [ split_addrs($addr) ]; + } + } + }, + + mailrc => sub { + + my $fh = shift; + + while (<$fh>) { + if (/^alias\s+(\S+)\s+(.*)$/) { + # spaces delimit multiple addresses + $aliases{$1} = [ split(/\s+/, $2) ]; + } + } + }, + + pine => sub { + + my $fh = shift; + my $f='\t[^\t]*'; + + for (my $x = ''; defined($x); $x = $_) { chomp $x; - $x .= $1 while(defined($_ = <$fh>) && /^ +(.*)$/); + $x .= $1 while(defined($_ = <$fh>) && /^ +(.*)$/); $x =~ /^(\S+)$f\t\(?([^\t]+?)\)?(:?$f){0,2}$/ or next; $aliases{$1} = [ split_addrs($2) ]; - }}, - gnus => sub { my $fh = shift; while (<$fh>) { - if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) { - $aliases{$1} = [ $2 ]; - }}} + } + }, + + gnus => sub { + + my $fh = shift; + + while (<$fh>) { + if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) { + $aliases{$1} = [ $2 ]; + } + } + } ); if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) {
@@ -571,10 +602,11 @@ EOT } elsif (/^\n$/) { $in_body = 1; if ($need_8bit_cte) { - print C2 "MIME-Version: 1.0\n", - "Content-Type: text/plain; ", - "charset=utf-8\n", - "Content-Transfer-Encoding: 8bit\n"; + print C2 + "MIME-Version: 1.0\n", + "Content-Type: text/plain; ", + "charset=utf-8\n", + "Content-Transfer-Encoding: 8bit\n"; } } elsif (/^MIME-Version:/i) { $need_8bit_cte = 0;
@@ -583,8 +615,8 @@ EOT my $subject = $initial_subject; $_ = "Subject: " . ($subject =~ /[^[:ascii:]]/ ? - quote_rfc2047($subject) : - $subject) . + quote_rfc2047($subject) : + $subject) . "\n"; } elsif (/^In-Reply-To:\s*(.+)\s*$/i) { $initial_reply_to = $1;
@@ -616,8 +648,10 @@ sub ask { my $resp; my $i = 0; return defined $default ? $default : undef - unless defined $term->IN and defined fileno($term->IN) and - defined $term->OUT and defined fileno($term->OUT); + unless defined $term->IN + and defined fileno($term->IN) + and defined $term->OUT + and defined fileno($term->OUT); while ($i++ < 10) { $resp = $term->readline($prompt); if (!defined $resp) { # EOF
@@ -637,8 +671,12 @@ sub ask { my $prompting = 0; if (!defined $sender) { $sender = $repoauthor || $repocommitter || ''; - $sender = ask("Who should the emails appear to be from? [$sender] ", - default => $sender); + + $sender = ask( + "Who should the emails appear to be from? [$sender] ", + default => $sender + ); + print "Emails will be sent from: ", $sender, "\n"; $prompting++; }
@@ -666,7 +704,8 @@ sub expand_aliases { if ($thread && !defined $initial_reply_to && $prompting) { $initial_reply_to = ask( - "Message-ID to be used as In-Reply-To for the first email? "); + "Message-ID to be used as In-Reply-To for the first email? " + ); } if (defined $initial_reply_to) { $initial_reply_to =~ s/^\s*<?//;
@@ -806,18 +845,22 @@ sub sanitize_address sub send_message { my @recipients = unique_email_list(@to); - @cc = (grep { my $cc = extract_valid_address($_); - not grep { $cc eq $_ } @recipients - } - map { sanitize_address($_) } - @cc); + + @cc = (grep + { + my $cc = extract_valid_address($_); + not grep { $cc eq $_ } @recipients + } + map { sanitize_address($_) } @cc + ); + my $to = join (",\n\t", @recipients); @recipients = unique_email_list(@recipients,@cc,@bcclist); @recipients = (map { extract_valid_address($_) } @recipients); my $date = format_2822_time($time++); my $gitversion = '@@GIT_VERSION@@'; if ($gitversion =~ m/..GIT_VERSION../) { - $gitversion = Git::version(); + $gitversion = Git::version(); } my $cc = join(", ", unique_email_list(@cc));
@@ -866,9 +909,13 @@ X-Mailer: git-send-email $gitversion print " To retain the current behavior, but squelch this message,\n"; print " run 'git config --global sendemail.confirm auto'.\n\n"; } - $_ = ask("Send this email? ([y]es|[n]o|[q]uit|[a]ll): ", - valid_re => qr/^(?:yes|y|no|n|quit|q|all|a)/i, - default => $ask_default); + + $_ = ask( + "Send this email? ([y]es|[n]o|[q]uit|[a]ll): ", + valid_re => qr/^(?:yes|y|no|n|quit|q|all|a)/i, + default => $ask_default + ); + die "Send this email reply required" unless defined $_; if (/^n/i) { return 0;
@@ -903,9 +950,13 @@ X-Mailer: git-send-email $gitversion } else { require Net::SMTP; - $smtp ||= Net::SMTP->new((defined $smtp_server_port) - ? "$smtp_server:$smtp_server_port" - : $smtp_server); + + $smtp ||= Net::SMTP->new( + (defined $smtp_server_port) + ? "$smtp_server:$smtp_server_port" + : $smtp_server + ); + if ($smtp_encryption eq 'tls') { require Net::SMTP::SSL; $smtp->command('STARTTLS');
@@ -1002,7 +1053,7 @@ foreach my $t (@files) { chomp($header[$#header]); s/^\s+/ /; $header[$#header] .= $_; - } else { + } else { push(@header, $_); } }
@@ -1120,9 +1171,9 @@ foreach my $t (@files) { } else { push @xh, - 'MIME-Version: 1.0', - "Content-Type: text/plain; charset=$author_encoding", - 'Content-Transfer-Encoding: 8bit'; + 'MIME-Version: 1.0', + "Content-Type: text/plain; charset=$author_encoding", + 'Content-Transfer-Encoding: 8bit'; } } }
@@ -1130,7 +1181,9 @@ foreach my $t (@files) { $needs_confirm = ( $confirm eq "always" or ($confirm =~ /^(?:auto|cc)$/ && @cc) or - ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); + ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1) + ); + $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); @cc = (@initial_cc, @cc);
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 10/13 send-email: Add --sleep for email throttling
The --sleep option provides a means for specifying that there should be a certain number of seconds of delay after sending a certain number of emails; see Documentation/git-send-email.txt
--- Documentation/git-send-email.txt | 30 +++++++++++++++ git-send-email.perl | 74 +++++++++++++++++++++++++++++++++++--- 2 files changed, 99 insertions(+), 5 deletions(-)
Documentation/git-send-email.txt +30 -0
@@ -178,6 +178,36 @@ Automating cc list. Default is the value of 'sendemail.signedoffbycc' configuration value; if that is unspecified, default to --signed-off-by-cc. +--sleep=<seconds>[,<burst>]:: + This option specfies that send-email should sleep for <seconds> + after sending <burst> messages as quickly as possible; <seconds> + should be an integer >= 0 and <burst> should be an integer >= 1. + This mode of operation attacks 2 problems: email throttling and + arrival disorder. Default is the value of the 'sendemail.sleep' + configuration variable, or '0' if that does not exist. ++ +By default, send-email tries to send one patch per email as quickly as +possible. Unfortunately, some email services restrict a user by refusing +to send more than some maximum number of email messages, M, in a given +period of seconds, S. This can be troublesome if the patch series has +more than M patches, because the server will ultimately refuse to send +some of them. In this case, simply pass '--sleep=S,M' or '--sleep S,M' +or set sendemail.sleep to 'S,M'. ++ +Moreover, the emails often arrive at the final destination out of order; +though send-email manipulates the date fields and usually chains subsequent +emails via the In-Reply-To headers, some mail viewers nevertheless insist +on presenting them by order of arrival. This may be mitigated by using +something like '--sleep 60' (the equivalent of '--sleep 60,1'), so that +there is a 60 second delay between sending any two messages. ++ +*Note*: Because of varying routes and batching schemes, there is no delay +that can guarantee the correct arrival order. Obviously, one solution is to +choose an obscenely large number, so be prepared to run send-email in the +background. Of course, spreading emails across time makes it more likely +that unrelated email messages arrive between patches. Therefore, send-email +warns you if both --sleep and --no-chain-reply-to are used. + --suppress-cc=<category>:: Specify an additional category of recipients to suppress the auto-cc of:
git-send-email.perl +69 -5
122 lines not on this page · raw message
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 11/13 send-email: Minor cleanup of $smtp_server usage and send_message()
Note that the output has been changed; the server return code now appears after the `(Sendmail|Server):' line, rather than after the headers.
--- Documentation/git-send-email.txt | 8 ++++-- git-send-email.perl | 41 ++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 18 deletions(-)
Documentation/git-send-email.txt +5 -3
@@ -130,9 +130,11 @@ user is prompted for a password while the input is masked for privacy. specify a full pathname of a sendmail-like program instead; the program must support the `-i` option. Default value can be specified by the 'sendemail.smtpserver' configuration - option; the built-in default is `/usr/sbin/sendmail` or - `/usr/lib/sendmail` if such program is available, or - `localhost` otherwise. + variable; the built-in default is `/usr/sbin/sendmail` or + `/usr/lib/sendmail` if such a program is available, or + `localhost` otherwise. Also, a built-in default is used if + <host> is the empty string (for example, if '--smtp-server ""' + is specified on the command line). --smtp-server-port=<port>:: Specifies a port different from the default port (SMTP
git-send-email.perl +26 -15
78 lines not on this page · raw message
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 12/13 send-email: --compose takes optional argument to existing file
Now, a user may specify an existing (in-progress) file to use as the introductory/summary email.
The file is opened for any additional editing as usual, but it is not deleted upon normal termination.
There are also a number of fixes to how the internals and temporaries are handled.
Also, it is no longer possible to pass --compose multiple times in order to edit the transformed version as well.
Also, send-email now aborts upon discovering an empty message.
--- Documentation/git-send-email.txt | 40 +++++++-- git-send-email.perl | 182 ++++++++++++++++++++++++-------------- 2 files changed, 145 insertions(+), 77 deletions(-)
Documentation/git-send-email.txt +31 -9
@@ -55,17 +55,39 @@ The --bcc option must be repeated for each user you want on the bcc list. + The --cc option must be repeated for each user you want on the cc list. ---compose:: - Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an - introductory message for the patch series. +--compose[=<path>]:: + Create an introductory message for the patch series; the + message is opened for editing with (in order of preference) + `$GIT_EDITOR`, 'core.editor', `$VISUAL`, `$EDITOR`, or `vi`. + -When '--compose' is used, git send-email will use the From, Subject, and -In-Reply-To headers specified in the message. If the body of the message -(what you type after the headers and a blank line) only contains blank -(or GIT: prefixed) lines the summary won't be sent, but From, Subject, -and In-Reply-To headers will be used unless they are removed. +A path for the composition may be given. If the path exists, then +the file at the path is opened for editing as-is. If the path +doesn't exist, a file with default content is created at the path +and opened for editing. If no path is specified, a new temporary +file with default content is created and opened for editing. + -Missing From or In-Reply-To headers will be prompted for. +Upon the successful completion of send-email, all temporary files +are automatically unlinked (deleted). However, if send-email is +terminated by a trappable signal, then this temporary file is not +unlinked, and the user is informed of its path. ++ +The user actually composes what will become a valid email message; +therefore, the message must have the following form (as described in +`RFC 822`): ++ + <headers> + <blank line> + <body> ++ +In particular, `<headers>` must contain the "`Subject`" header. Once +the user saves the message and quits the editor, this intermediate +message is transformed into the final email message by removing all +lines that begin with "`GIT:`". If the `<body>` of the final version +is empty, then send-email aborts without sending anything. ++ +The "`From`", "`Subject`", and "`In-Reply-To`" headers are taken +directly from the message; missing "`From`" or "`In-Reply-To`" +headers will be prompted for. + See the CONFIGURATION section for 'sendemail.multiedit'.
git-send-email.perl +114 -68
268 lines not on this page · raw message
Signature · 1 line
1.6.2.2.479.g2aec
PATCH 13/13 send-email: --compose always includes a 'GIT: ' prefixed list of patch subjects
I've found that having a list of the patch subjects appended to the end of an existing --compose email is quite useful.
I've tried to make appending smart enough not to alter existing lines beyond the addition of some kind of newline.
--- Documentation/git-send-email.txt | 3 ++- git-send-email.perl | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-)
Documentation/git-send-email.txt +2 -1
@@ -61,7 +61,8 @@ The --cc option must be repeated for each user you want on the cc list. `$GIT_EDITOR`, 'core.editor', `$VISUAL`, `$EDITOR`, or `vi`. + A path for the composition may be given. If the path exists, then -the file at the path is opened for editing as-is. If the path +the file at the path is opened for editing with the list of patch +subjects (prefixed with 'GIT: ') appended to the end. If the path doesn't exist, a file with default content is created at the path and opened for editing. If no path is specified, a new temporary file with default content is created and opened for editing.
git-send-email.perl +18 -2
@@ -644,9 +644,25 @@ if (defined $compose) { print "GIT: This is the first line of the <body>:\n"; print "\n"; - for my $f (@files) { - print get_patch_subject($f); + print get_patch_subject($_) for (@files); + + } else { + + # Supply a listing of the patch subjects, in case + # it might be useful to the user: + + open $compose_path_filehandle, "+<", $compose_path + or die "--compose: Could not open '$compose_path' for appending listing: $!\n"; + + # Figure out whether we should begin a new line + # (we don't want to append to an existing line): + + if (seek $compose_path_filehandle, -1, 2) { + read $compose_path_filehandle, my $c, 1; + $c !~ /\n|\r/ and print $compose_path_filehandle "\n"; } + + print $compose_path_filehandle get_patch_subject($_) for (@files); } # Do the editing:
Signature · 1 line
1.6.2.2.479.g2aec
Re: [PATCH RFC3 09/13] send-email: Remove horrible mix of tabs and spaces
In reply to Michael WittenQuoted 4 lines · Michael Witten
Currently, no lines match the following:
[\t]+[ ]+ [ ]+[\t]+
I understand the latter but what's wrong with the former? The width of a HT is by definition 8 columns throughout the git codebase.
Re: [PATCH RFC3 09/13] send-email: Remove horrible mix of tabs and spaces
Quoted 9 lines · Junio C Hamano
Quoted 4 lines · Michael Witten
Currently, no lines match the following:
[\t]+[ ]+
[ ]+[\t]+I understand the latter but what's wrong with the former? The width of a HT is by definition 8 columns throughout the git codebase.
Ah, well, the width of a HT has been a free variable in my calculations; I was operating under the assumption that whitespace used for indentation can float freely according to the user's settings. A few of the lines were aligning function arguments via tabs and a few extra spaces, which is not reliable in my model.
Frankly, I don't like tabs and spaces sharing the same contiguous block. I don't like it all. ;-B
Re: [PATCH RFC3 09/13] send-email: Remove horrible mix of tabs and spaces
Quoted 10 lines · Michael Witten
Quoted 8 lines · Junio C Hamano
Quoted 4 lines · Michael Witten
Currently, no lines match the following:
[\t]+[ ]+ [ ]+[\t]+I understand the latter but what's wrong with the former? The width of a HT is by definition 8 columns throughout the git codebase.
Quoted 8 lines
Ah, well, the width of a HT has been a free variable in my calculations; I was operating under the assumption that whitespace used for indentation can float freely according to the user's settings. A few of the lines were aligning function arguments via tabs and a few extra spaces, which is not reliable in my model.
Frankly, I don't like tabs and spaces sharing the same contiguous block. I don't like it all. ;-B
Using tabs to align stuff to indentation level and spaces to align line continuation is the only possible way to let users choose whichever indentation depth they want while preserving the continuation alignment. What's not to like about that? Especially if you think a horizontal tab can be any size at all, you should be all agog.
Signature · 7 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 Considering the successes of the wars on alcohol, poverty, drugs and terror, I think we should give some serious thought to declaring war on peace.
Re: [PATCH RFC3 09/13] send-email: Remove horrible mix of tabs and spaces
Quoted 20 lines · Andreas Ericsson
Quoted 19 lines · Michael Witten
Quoted 10 lines · Junio C Hamano
Quoted 4 lines · Michael Witten
Currently, no lines match the following:
[\t]+[ ]+ [ ]+[\t]+I understand the latter but what's wrong with the former? The width of a HT is by definition 8 columns throughout the git codebase.
Ah, well, the width of a HT has been a free variable in my calculations; I was operating under the assumption that whitespace used for indentation can float freely according to the user's settings. A few of the lines were aligning function arguments via tabs and a few extra spaces, which is not reliable in my model.
Quoted 8 lines
Quoted 2 lines
Frankly, I don't like tabs and spaces sharing the same contiguous block. I don't like it all. ;-B
Using tabs to align stuff to indentation level and spaces to align line continuation is the only possible way to let users choose whichever indentation depth they want while preserving the continuation alignment. What's not to like about that? Especially if you think a horizontal tab can be any size at all, you should be all agog.
However, nobody ever gets that right, because they don't understand what you mean by indentation level. For most code that people write, indentation whitespace overlaps with non-whitespace (from the previous line). Therefore, the spaces used for continuation alignment with the previous line are left 'sitting on shaky ground'. For instance, consider this fine piece of code, given by lines 609-612 in builtin-log.c. If you're viewing this code with a monospace font and HT set to 8 columns, then the tab->spaces expansion should give the following result (monospace font required to view this properly):
static void make_cover_letter(struct rev_info *rev, int use_stdout,
int numbered, int numbered_files, struct commit *origin,
int nr, struct commit **list, struct commit *head)
Beautiful, isn't it?
In this case, we're at indentation level ---> 0 <---, and this means that to form the continuation alignment, 0 tabs should be used followed by however many spaces are needed to achieve the alignment. However, whoever wrote that code actually used indentation level 3:
<HT><HT><HT><SP><SP><SP><SP><SP><SP>
The problem is that variable-width characters (HTs) are being aligned with fixed-width characters. For shame!
To be explicit, if the HT width is set to 4, the result would be (after HT->spaces expansion):
static void make_cover_letter(struct rev_info *rev, int use_stdout,
int numbered, int numbered_files, struct commit *origin,
int nr, struct commit **list, struct commit *head)
Clearly, this is never a problem if you declare HTs to be fixed-width (which, I believe, Linus did do: 8 columns per HT), or if you can remember that HTs should never be used to align against non-HTs.
What I like to do is provide a more regular structure that removes the juxtaposition of indentation and alignment whitespace. Basically, HTs and spaces should never be contiguous, and the first use of a non-HT prohibits HTs from being used anywhere further down the line. Also, the structure of the code should facilitate identation levels:
static void make_cover_letter
(
/* These are all at indentation level 1 */
struct rev_info* rev ,
int use_stdout ,
int numbered ,
int numbered_files ,
struct commit* origin ,
int nr ,
struct commit** list ,
struct commit* head
)
{
/* Code at indentation level 1 */
}Yeah, yeah, I know it's crazy, but it makes code wildly readable---to me.
Sincerely,
Michael Witten
Re: [PATCH RFC3 09/13] send-email: Remove horrible mix of tabs and spaces
Quoted 40 lines · Michael Witten
Quoted 16 lines · Andreas Ericsson
Quoted 15 lines · Michael Witten
Quoted 8 lines · Junio C Hamano
Quoted 4 lines · Michael Witten
Currently, no lines match the following:
[\t]+[ ]+ [ ]+[\t]+I understand the latter but what's wrong with the former? The width of a HT is by definition 8 columns throughout the git codebase.
Ah, well, the width of a HT has been a free variable in my calculations; I was operating under the assumption that whitespace used for indentation can float freely according to the user's settings. A few of the lines were aligning function arguments via tabs and a few extra spaces, which is not reliable in my model.
Quoted 7 lines
Quoted 2 lines
Frankly, I don't like tabs and spaces sharing the same contiguous block. I don't like it all. ;-B
Using tabs to align stuff to indentation level and spaces to align line continuation is the only possible way to let users choose whichever indentation depth they want while preserving the continuation alignment. What's not to like about that? Especially if you think a horizontal tab can be any size at all, you should be all agog.
However, nobody ever gets that right, because they don't understand what you mean by indentation level. For most code that people write, indentation whitespace overlaps with non-whitespace (from the previous line). Therefore, the spaces used for continuation alignment with the previous line are left 'sitting on shaky ground'. For instance, consider this fine piece of code, given by lines 609-612 in
builtin-log.c. If you're viewing this code with a monospace font and HT set to 8 columns, then thetab->spacesexpansion should give the following result (monospace font required to view this properly):static void make_cover_letter(struct
rev_info*rev, intuse_stdout,
int numbered, intnumbered_files, struct commit *origin,
int nr, struct commit **list, struct commit *head)
Quoted 9 lines
Beautiful, isn't it?
In this case, we're at indentation level ---> 0 <---, and this means that to form the continuation alignment, 0 tabs should be used followed by however many spaces are needed to achieve the alignment. However, whoever wrote that code actually used indentation level 3:
<HT><HT><HT><SP><SP><SP><SP><SP><SP>
Well, that would have been true if git had used "indent with tabs align with spaces" (allowing variable width HT's), but HT is defined as 8 spaces wide, so that's a non-issue for us.
Quoted 6 lines
The problem is that variable-width characters (HTs) are being aligned with fixed-width characters. For shame!
To be explicit, if the HT width is set to 4, the result would be (after
HT->spacesexpansion):
Quoted 9 lines
static void make_cover_letter(struct
rev_info*rev, intuse_stdout,
int numbered, intnumbered_files, struct commit *origin,
int nr, struct commit **list, struct commit *head)Clearly, this is never a problem if you declare HTs to be fixed-width (which, I believe, Linus did do: 8 columns per HT), or if you can remember that HTs should never be used to align against non-HTs.
There you have it then; It's not a problem for git.git, and yet you propose to fix it.
Quoted 19 lines
What I like to do is provide a more regular structure that removes the juxtaposition of indentation and alignment whitespace. Basically, HTs and spaces should never be contiguous, and the first use of a non-HT prohibits HTs from being used anywhere further down the line. Also, the structure of the code should facilitate identation levels:
static void
make_cover_letter
(
/* These are all at indentation level 1 */struct rev_info* rev ,
intuse_stdout,
int numbered ,
intnumbered_files,
struct commit* origin ,
int nr ,
struct commit** list ,
struct commit* head
)
Quoted 6 lines
{ /* Code at indentation level 1 */ }Yeah, yeah, I know it's crazy, but it makes code wildly readable---to me.
It would still fail with a variable-width font though, which you seem keen on reminding people about.
Since you seem really, really keen on getting this done, here's the only way Junio would possibly even consider your new indentation style for git.git:
* Make patches for all the .c and .h files.
* Make patches to all topics sent to the list that haven't been merged or dropped yet so that merges can go on cleanly.
* Create a public git repository somewhere which Junio can fetch from, marking your topic-branches clearly.
* Come up with a better argument than "Hey, this is better for me". Since churning code just to make life a little bit easier for one guy responsible for 0.07% of the committed codebase would be damn silly, I'm reasonably certain Junio will just shake his head at your proposal. Without the patches though, he'll probably not even look at it.
There's one pretty good reason *not* to change indentation though:
Ownership tracking in case of relicensing. Currently, the "owners" of a file in git.git can be determined pretty accurately by issuing
git blame -C -C -M "$f" | \
sed -e 's/[^(]*(\([^0-9]*\).*/\1/' -e 's/[\t ]*$//' \
| sort | uniq -c | sort -nr
which is immensely useful when asking permission to relicense code for libgit2. With your proposed code churn, that goes out the window for no benefit what so ever.
Happy hacking. I'll drop this subject now, hoping you do the same.
Signature · 7 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 Considering the successes of the wars on alcohol, poverty, drugs and terror, I think we should give some serious thought to declaring war on peace.
Re: [PATCH RFC3 09/13] send-email: Remove horrible mix of tabs and spaces
In reply to Andreas EricssonQuoted 4 lines · Andreas Ericsson
Using tabs to align stuff to indentation level and spaces to align line continuation is the only possible way to let users choose whichever indentation depth they want while preserving the continuation alignment.
Sure, it will look aligned with whatever width of HT ">":
>>if (this is a looong
>>....expression that is alighed) {
>>>statement1;
>>>statement2;
>>}but it is *only true* if your SP "." and everything else is of the same width.
People seem to repeat that without realizing what they are saying, but I find the assumption the argument is based on quite bogus. Why do people think it is only sane to assume flexible HT width but still monospaced font whose SP, l and w are all of the same width?
You either forget about the alignment (there is no such thing---suck it up), or use time honored HT=8 and monospace convention.
And this project uses the latter.
Re: [PATCH RFC3 09/13] send-email: Remove horrible mix of tabs and spaces
Quoted 15 lines · Junio C Hamano
Quoted 4 lines · Andreas Ericsson
Using tabs to align stuff to indentation level and spaces to align line continuation is the only possible way to let users choose whichever indentation depth they want while preserving the continuation alignment.
Sure, it will look aligned with whatever width of HT ">":
>>if (this is a looong >>....expression that is alighed) { >>>statement1; >>>statement2; >>}
Quoted 8 lines
but it is *only true* if your SP "." and everything else is of the same width.
People seem to repeat that without realizing what they are saying, but I find the assumption the argument is based on quite bogus. Why do people think it is only sane to assume flexible HT width but still monospaced font whose SP, l and w are all of the same width?
Because 99% of all editors designed for programming use a fixed-width font by default for precisely that reason, and all others can be set to display fixed-width fonts without losing much (if any) readability, but indentation comes in 2*$number_of_programmers variations.
Quoted 3 lines
You either forget about the alignment (there is no such thing---suck it up), or use time honored HT=8 and monospace convention.
Or you use "indent with tabs, align with spaces" and let those who use a word processor for programming go hang. It's quite common actually. Or you use some own homecooked style of indentation that's quite obvious *to you* Either way, a project's founding father always sets the style, and those who contribute get to either follow it or provide some pretty strong argument to change it (a lot better than:
"A few of the lines were aligning function arguments via tabs and a few extra spaces, which is not reliable in my model.
Frankly, I don't like tabs and spaces sharing the same contiguous block. I don't like it all."
Signature · 7 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 Considering the successes of the wars on alcohol, poverty, drugs and terror, I think we should give some serious thought to declaring war on peace.
Re: [PATCH RFC3 08/13] send-email: Remove superfluous `my $editor = ...'
In reply to Michael Wittengit-send-email.perl EOT · line 552
Quoted 1 line · Michael Witten
git-send-email.perl +0
-1- my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
I don't want to start an editor war, but why is 'vi' here? It seems that one of the previous four should be set at all times, correct?
Re: [PATCH RFC3 08/13] send-email: Remove superfluous `my $editor = ...'
Quoted 5 lines · Stephen Boyd
git-send-email.perl EOT · line 552
Quoted 1 line · Michael Witten
git-send-email.perl +0
-1- my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";I don't want to start an editor war, but why is 'vi' here? It seems that one of the previous four should be set at all times, correct?
Probably because that's how the rest of git works, too. See core.editor in git-config(1) or launch_editor() in editor.c if you don't trust the docs.
Oh, and I seem to rely on that behaviour :-)
Björn
Re: [PATCH RFC3 08/13] send-email: Remove superfluous `my $editor = ...'
Quoted 7 lines · Björn Steinbrink
Quoted 5 lines · Stephen Boyd
git-send-email.perl EOT · line 552
Quoted 1 line · Michael Witten
git-send-email.perl +0
-1- my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";I don't want to start an editor war, but why is 'vi' here? It seems that one of the previous four should be set at all times, correct?
Quoted 5 lines
Probably because that's how the rest of git works, too. See core.editor in git-config(1) or
launch_editor()ineditor.cif you don't trust the docs.Oh, and I seem to rely on that behaviour :-)
The git specific parts are obviously our invention, but $VISUAL then $EDITOR and finally as the last resort falling back on vi has been a longstanding UNIXy tradition that is shared by many tools.
Re: [PATCH RFC3 08/13] send-email: Remove superfluous `my $editor = ...'
In reply to Stephen BoydQuoted 1 line · Stephen Boyd
I don't want to start an editor war, but why is 'vi' here?
The program vi is on every single Unix installation. Take that as an axiom.
Re: [PATCH RFC3 08/13] send-email: Remove superfluous `my $editor = ...'
Quoted 4 lines · Michael Witten
Quoted 1 line · Stephen Boyd
I don't want to start an editor war, but why is 'vi' here?
The program vi is on every single Unix installation. Take that as an axiom.
However, I would be OK with confronting the user about setting one of the variables.
Re: [PATCH RFC3 05/13] send-email: Cleanup the usage text and docs a bit
In reply to Michael WittenQuoted 4 lines · Michael Witten
All usage text lines should be < 80 characters.
A port number in --smtp-server is no longer handled, so the suggestion has been removed.
That makes it sound like there is a regression.
require Net::SMTP; $smtp ||= Net::SMTP->new((defined $smtp_server_port) ? "$smtp_server:$smtp_server_port" : $smtp_server);
and because Net::SMTP is a subclass of IO::Socket::INET, I'd assume that this use will accept smtp_server=there:submission when $smtp_server_port is undef.
Quoted 2 lines
---in-reply-to=<identifier>::
+--in-reply-to=<message-id>::
Changes along this line in your patch looked sensible, except for the "identity" one which is a bit iffy.
Other than that I think the patch is sane.
Re: [PATCH RFC3 05/13] send-email: Cleanup the usage text and docs a bit
Quoted 9 lines · Junio C Hamano
Quoted 4 lines · Michael Witten
All usage text lines should be < 80 characters.
A port number in --smtp-server is no longer handled, so the suggestion has been removed.
That makes it sound like there is a regression.
Quoted 8 lines
require
Net::SMTP;
$smtp ||=Net::SMTP->new((defined $smtp_server_port) ? "$smtp_server:$smtp_server_port" : $smtp_server);and because
Net::SMTPis a subclass ofIO::Socket::INET, I'd assume that this use will accept smtp_server=there:submission when $smtp_server_port is undef.
I may have been concerned that the SSL connection code doesn't support a host:port specification, so I thought it would be easier not to advertise it:
Quoted 7 lines
if ($smtp_encryption eq 'ssl') {
$smtp_server_port ||= 465; # ssmtp
require Net::SMTP::SSL;
$smtp ||= Net::SMTP::SSL->new($smtp_server, Port => $smtp_server_port);
}Quoted 5 lines
Quoted 2 lines
---in-reply-to=<identifier>::
+--in-reply-to=<message-id>::Changes along this line in your patch looked sensible, except for the "identity" one which is a bit iffy.
The change to <id> ? Well, I did so, because the usage text uses <id> for compactness; I think everything else matches.
Re: [PATCH RFC3 05/13] send-email: Cleanup the usage text and docs a bit
Quoted 6 lines · Michael Witten
Quoted 2 lines
Quoted 2 lines
A port number in --smtp-server is no longer handled, so the suggestion has been removed.
...
I may have been concerned that the SSL connection code doesn't support a host:port specification, so I thought it would be easier not to advertise it:
These two statements contradict with each other. Please make up your mind ;-).
Re: [PATCH RFC3 05/13] send-email: Cleanup the usage text and docs a bit
Quoted 11 lines · Junio C Hamano
Quoted 6 lines · Michael Witten
Quoted 2 lines
Quoted 2 lines
A port number in --smtp-server is no longer handled, so the suggestion has been removed.
...
I may have been concerned that the SSL connection code doesn't support a host:port specification, so I thought it would be easier not to advertise it:These two statements contradict with each other. Please make up your mind ;-).
I'm confused.
The usage text for --smtp-server currently has <host:port>, which doesn't work when 'ssl' is used for the connection to the server. However, the other forms of connection DO work when a <host:port> address is given.
I set out to add <host:port> support for SSL, but then decided that people should just use the --smtp-server-port input. It already works for every connection method and why else have it? However, rather than remove ALL support for <host:port>, I just changed <host:port> to <host> in the usage text for --smtp-server.
So, effectively, I've deprecated <host:port> by changing the documentation, but the code hasn't changed. Would you rather support <host:port> for everything?
Re: [PATCH RFC3 05/13] send-email: Cleanup the usage text and docs a bit
Quoted 2 lines · Michael Witten
The usage text for --smtp-server currently has <host:port>, which doesn't work when 'ssl' is used for the connection to the server.
Ah, I see. But it does work when ssl is not used, right? A possible solution would be one of:
- support host:port in SSL codepath (shouldn't it be trivial?);
- split the description in the documentation to clarify it does not work for SSL; or
- remove host:port support to make both consistent.
To me, the last one makes the least sense. Is that the approach you are taking?
Re: [PATCH RFC3 05/13] send-email: Cleanup the usage text and docs a bit
Quoted 6 lines · Junio C Hamano
Quoted 2 lines · Michael Witten
The usage text for --smtp-server currently has <host:port>, which doesn't work when 'ssl' is used for the connection to the server.
Ah, I see. But it does work when ssl is not used, right?
Right.
Quoted 3 lines
A possible solution would be one of:
- support host:port in SSL codepath (shouldn't it be trivial?);
Extremely trivial.
Quoted 7 lines
- split the description in the documentation to clarify it does not work for SSL; or
- remove host:port support to make both consistent.
To me, the last one makes the least sense. Is that the approach you are taking?
That is SORT OF the approach I took. I got lazy and didn't care to make <host:port> work for SSL, because there is already --smtp-server-port and by just replacing <host:port> with <host> in the USAGE text, the whole <host:port> notation was effectively deprecated but still usable as before. Genius, right? Grade *A* laziness.
Re: [PATCH RFC3 03/13] Docs: send-email: Remove superfluous information in CONFIGURATION
In reply to Michael WittenI
Quoted 13 lines · Michael Witten
n particular, sendemail.confirm was removed, because it's already described along with its corresponding option.
Signed-off-by Michael Witten <[email protected]>--- Documentation/git-send-email.txt | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)Documentation/git-send-email.txt +0
-0
Documentation/git-send-email.txt sendemail.multiedit:: · line 277
Quoted 7 lines
Documentation/git-send-email.txt +0
-4@@ -271,12 +271,6 @@ sendemail.multiedit:: summary when '--compose' is used). If false, files will be edited one after the other, spawning a new editor each time. -sendemail.confirm:: - Sets the default for whether to confirm before sending. Must be - one of 'always', 'never', 'cc', 'compose', or 'auto'. See '--confirm' - in the previous section for the meaning of these values.
I am not sure if this is a good idea. It may look "superfluous" for people who read the manual cover-to-cover. However, a new person whose mentor allowed her to peek into his configuration to learn tricks from may find sendemail.confirm and would try to find an entry in the manual. The change in this patch will make it inconvenient to go from variable to description.
Re: [PATCH RFC3 03/13] Docs: send-email: Remove superfluous information in CONFIGURATION
Quoted 2 lines · Junio C Hamano
I am not sure if this is a good idea. It may look "superfluous" for people who read the manual cover-to-cover.
People don't do this? How else are you supposed to know what's going on?
Quoted 5 lines
However, a new person whose
mentor allowed her to peek into his configuration to learn tricks from may find sendemail.confirm and would try to find an entry in the manual. The change in this patch will make it inconvenient to go from variable to description.
Well, couldn't she search? I doubt she'd try to look in the CONFIGURATION section anyway. I certainly wouldn't know about it without more experience.
Anyway, it's actually how this man page has been organized for a while; you'll notice that the CONFIGURATION section is pretty empty.
Perhaps the CONFIGURATION section should at least reference the associated command line argument, where a description can be found.
Quoted 1 line · Michael Witten
Here is the list of notable improvements:
I've picked up pieces that I think cannot possibly be controversial to reduce the size of the remaining patch series still in flight.
Michael Witten (6):
Docs: send-email: Put options back into alphabetical order
Docs: send-email: Refer to CONFIGURATION section for sendemail.multiedit
Docs: send-email: --smtp-server-port can take symbolic ports
send-email: Handle "GIT:" rather than "GIT: " during --compose
send-email: 'References:' should only reference what is sent
send-email: Remove superfluous `my $editor = ...'
I've reworded the description in "symbolic port names" one a bit.
It is unfortunate that the interesting ones begin at 10th in the series, which are beind the 9th one that is a "churn in the middle".
Thanks.
Quoted 3 lines · Junio C Hamano
It is unfortunate that the interesting ones begin at 10th in the series, which are beind the 9th one that is a "churn in the middle".
(http://marc.info/?l=git&m=123959564630157&w=2):
Quoted 1 line
The general rule of thumb is to do such a clean-up before you start to work on something of substance.
(http://marc.info/?l=git&m=123914648915106&w=2):
Quoted 1 line
a good rule of thumb when preparing a series is to have this kind of obvious clean-up first, leaving enhancement patches later in the series.
I guess, then, this whitespace patch is something of substance---an enhancement ;-D
... or unnecessary "code churn"... I suppose.
Quoted 8 lines · Michael Witten
Quoted 3 lines · Junio C Hamano
It is unfortunate that the interesting ones begin at 10th in the series, which are beind the 9th one that is a "churn in the middle".
(http://marc.info/?l=git&m=123959564630157&w=2):
Quoted 1 line
The general rule of thumb is to do such a clean-up before you start to work on something of substance.
Quoted 7 lines
(http://marc.info/?l=git&m=123914648915106&w=2):
Quoted 1 line
a good rule of thumb when preparing a series is to have this kind of obvious clean-up first, leaving enhancement patches later in the series.
I guess, then, this whitespace patch is something of substance---an enhancement ;-D
... or unnecessary "code churn"... I suppose.
An obviously good and uncontroversial clean-up should come first, so that it can be applied and meat of the change can be discussed on the cleaned base version.
A clean-up that might be judged as a mere churn should come last, so that enhancements and fixes can go first without waiting for the controversy to settle.
Quoted 14 lines · Junio C Hamano
Quoted 6 lines
Quoted 2 lines
It is unfortunate that the interesting ones begin at 10th in the series, which are beind the 9th one that is a "churn in the middle".
(http://marc.info/?l=git&m=123959564630157&w=2):
Quoted 1 line
The general rule of thumb is to do such a clean-up before you start to work on something of substance.
Quoted 7 lines
(http://marc.info/?l=git&m=123914648915106&w=2):
Quoted 1 line
a good rule of thumb when preparing a series is to have this kind of obvious clean-up first, leaving enhancement patches later in the series.
I guess, then, this whitespace patch is something of substance---an enhancement ;-D
... or unnecessary "code churn"... I suppose.
Quoted 7 lines
An obviously good and uncontroversial clean-up should come first, so that it can be applied and meat of the change can be discussed on the cleaned base version.
A clean-up that might be judged as a mere churn should come last, so that enhancements and fixes can go first without waiting for the controversy to settle.
I'm was just being facetious. In fact, I have already moved that patch to the end on my side.
Quoted 5 lines · Michael Witten
Docs: send-email: Remove superfluous information in CONFIGURATION
* Remove comment block?Docs: send-email: Put options back into alphabetical order
* Remove comment block?
s/?//
Quoted 1 line
[PATCH RFC3 12/13] send-email: --compose takes optional argument to existing file
This would be better: "send-email: --compose takes optional path"