* mw/sendemail:
  bash completion: Add --[no-]validate to "git send-email"
  send-email: signedoffcc -> signedoffbycc, but handle both
  Docs: send-email: Create logical groupings for man text
  Docs: send-email: Create logical groupings for --help text
  Docs: send-email: Remove unnecessary config variable description
  Docs: send-email: --chain_reply_to -> --[no-]chain-reply-to
  send-email: change --no-validate to boolean --[no-]validate
  Docs: send-email: Man page option ordering
  Docs: send-email usage text much sexier
  Docs: send-email's usage text and man page mention same options
This commit is contained in:
Shawn O. Pearce 2008-10-09 10:19:51 -07:00
Родитель 76c3fb1f84 fd3a8dcbbd
Коммит d5c527448d
3 изменённых файлов: 147 добавлений и 215 удалений

Просмотреть файл

@ -11,7 +11,6 @@ SYNOPSIS
'git send-email' [options] <file|directory> [... file|directory] 'git send-email' [options] <file|directory> [... file|directory]
DESCRIPTION DESCRIPTION
----------- -----------
Takes the patches given on the command line and emails them out. Takes the patches given on the command line and emails them out.
@ -20,12 +19,16 @@ The header of the email is configurable by command line options. If not
specified on the command line, the user will be prompted with a ReadLine specified on the command line, the user will be prompted with a ReadLine
enabled interface to provide the necessary information. enabled interface to provide the necessary information.
OPTIONS OPTIONS
------- -------
The options available are:
Composing
~~~~~~~~~
--bcc:: --bcc::
Specify a "Bcc:" value for each email. Specify a "Bcc:" value for each email. Default is the value of
'sendemail.bcc'.
+ +
The --bcc option must be repeated for each user you want on the bcc list. The --bcc option must be repeated for each user you want on the bcc list.
@ -34,22 +37,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. The --cc option must be repeated for each user you want on the cc list.
--cc-cmd::
Specify a command to execute once per patch file which
should generate patch file specific "Cc:" entries.
Output of this command must be single email address per line.
Default is the value of 'sendemail.cccmd' configuration value.
--chain-reply-to::
--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
this, it is recommended that the first file given be an overview of the
entire patch series.
Default is the value of the 'sendemail.chainreplyto' configuration
value; if that is unspecified, default to --chain-reply-to.
--compose:: --compose::
Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an
introductory message for the patch series. introductory message for the patch series.
@ -66,22 +53,47 @@ The --cc option must be repeated for each user you want on the cc list.
Only necessary if --compose is also set. If --compose Only necessary if --compose is also set. If --compose
is not set, this will be prompted for. is not set, this will be prompted for.
--signed-off-by-cc:: --subject::
--no-signed-off-by-cc:: Specify the initial subject of the email thread.
If this is set, add emails found in Signed-off-by: or Cc: lines to the Only necessary if --compose is also set. If --compose
cc list. is not set, this will be prompted for.
Default is the value of 'sendemail.signedoffcc' configuration value;
if that is unspecified, default to --signed-off-by-cc.
--quiet:: --to::
Make git-send-email less verbose. One line per email should be Specify the primary recipient of the emails generated. Generally, this
all that is output. will be the upstream maintainer of the project involved. Default is the
value of the 'sendemail.to' configuration value; if that is unspecified,
this will be prompted for.
+
The --to option must be repeated for each user you want on the to list.
--identity::
A configuration identity. When given, causes values in the Sending
'sendemail.<identity>' subsection to take precedence over ~~~~~~~
values in the 'sendemail' section. The default identity is
the value of 'sendemail.identity'. --envelope-sender::
Specify the envelope sender used to send the emails.
This is useful if your default address is not the address that is
subscribed to a list. If you use the sendmail binary, you must have
suitable privileges for the -f parameter. Default is the value of
the 'sendemail.envelopesender' configuration variable; if that is
unspecified, choosing the envelope sender is left to your MTA.
--smtp-encryption::
Specify the encryption to use, either 'ssl' or 'tls'. Any other
value reverts to plain SMTP. Default is the value of
'sendemail.smtpencryption'.
--smtp-pass::
Password for SMTP-AUTH. The argument is optional: If no
argument is specified, then the empty string is used as
the password. Default is the value of 'sendemail.smtppass',
however '--smtp-pass' always overrides this value.
+
Furthermore, passwords need not be specified in configuration files
or on the command line. If a username has been specified (with
'--smtp-user' or a 'sendemail.smtpuser'), but no password has been
specified (with '--smtp-pass' or 'sendemail.smtppass'), then the
user is prompted for a password while the input is masked for privacy.
--smtp-server:: --smtp-server::
If set, specifies the outgoing SMTP server to use (e.g. If set, specifies the outgoing SMTP server to use (e.g.
@ -96,61 +108,44 @@ The --cc option must be repeated for each user you want on the cc list.
--smtp-server-port:: --smtp-server-port::
Specifies a port different from the default port (SMTP Specifies a port different from the default port (SMTP
servers typically listen to smtp port 25 and ssmtp port servers typically listen to smtp port 25 and ssmtp port
465). 465). This can be set with 'sendemail.smtpserverport'.
--smtp-user::
Username for SMTP-AUTH. In place of this option, the following
configuration variables can be specified:
+
--
* sendemail.smtpuser
* sendemail.<identity>.smtpuser (see sendemail.identity).
--
+
However, --smtp-user always overrides these variables.
+
If a username is not specified (with --smtp-user or a
configuration variable), then authentication is not attempted.
--smtp-pass::
Password for SMTP-AUTH. The argument is optional: If no
argument is specified, then the empty string is used as
the password.
+
In place of this option, the following configuration variables
can be specified:
+
--
* sendemail.smtppass
* sendemail.<identity>.smtppass (see sendemail.identity).
--
+
However, --smtp-pass always overrides these variables.
+
Furthermore, passwords need not be specified in configuration files
or on the command line. If a username has been specified (with
--smtp-user or a configuration variable), but no password has been
specified (with --smtp-pass or a configuration variable), then the
user is prompted for a password while the input is masked for privacy.
--smtp-encryption::
Specify the encryption to use, either 'ssl' or 'tls'. Any other
value reverts to plain SMTP. Default is the value of
'sendemail.smtpencryption'.
--smtp-ssl:: --smtp-ssl::
Legacy alias for '--smtp-encryption=ssl'. Legacy alias for '--smtp-encryption ssl'.
--subject:: --smtp-user::
Specify the initial subject of the email thread. Username for SMTP-AUTH. Default is the value of 'sendemail.smtpuser';
Only necessary if --compose is also set. If --compose if a username is not specified (with '--smtp-user' or 'sendemail.smtpuser'),
is not set, this will be prompted for. then authentication is not attempted.
--suppress-from::
--no-suppress-from:: Automating
If this is set, do not add the From: address to the cc: list. ~~~~~~~~~~
Default is the value of 'sendemail.suppressfrom' configuration value;
if that is unspecified, default to --no-suppress-from. --cc-cmd::
Specify a command to execute once per patch file which
should generate patch file specific "Cc:" entries.
Output of this command must be single email address per line.
Default is the value of 'sendemail.cccmd' configuration value.
--[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
this, it is recommended that the first file given be an overview of the
entire patch series. Default is the value of the 'sendemail.chainreplyto'
configuration value; if that is unspecified, default to --chain-reply-to.
--identity::
A configuration identity. When given, causes values in the
'sendemail.<identity>' subsection to take precedence over
values in the 'sendemail' section. The default identity is
the value of 'sendemail.identity'.
--[no-]signed-off-by-cc::
If this is set, add emails found in Signed-off-by: or Cc: lines to the
cc list. Default is the value of 'sendemail.signedoffbycc' configuration
value; if that is unspecified, default to --signed-off-by-cc.
--suppress-cc:: --suppress-cc::
Specify an additional category of recipients to suppress the Specify an additional category of recipients to suppress the
@ -163,44 +158,43 @@ user is prompted for a password while the input is masked for privacy.
if that is unspecified, default to 'self' if --suppress-from is if that is unspecified, default to 'self' if --suppress-from is
specified, as well as 'sob' if --no-signed-off-cc is specified. specified, as well as 'sob' if --no-signed-off-cc is specified.
--thread:: --[no-]suppress-from::
--no-thread:: If this is set, do not add the From: address to the cc: list.
Default is the value of 'sendemail.suppressfrom' configuration
value; if that is unspecified, default to --no-suppress-from.
--[no-]thread::
If this is set, the In-Reply-To header will be set on each email sent. If this is set, the In-Reply-To header will be set on each email sent.
If disabled with "--no-thread", no emails will have the In-Reply-To If disabled with "--no-thread", no emails will have the In-Reply-To
header set. header set. Default is the value of the 'sendemail.thread' configuration
Default is the value of the 'sendemail.thread' configuration value; value; if that is unspecified, default to --thread.
if that is unspecified, default to --thread.
Administering
~~~~~~~~~~~~~
--dry-run:: --dry-run::
Do everything except actually send the emails. Do everything except actually send the emails.
--envelope-sender:: --quiet::
Specify the envelope sender used to send the emails. Make git-send-email less verbose. One line per email should be
This is useful if your default address is not the address that is all that is output.
subscribed to a list. If you use the sendmail binary, you must have
suitable privileges for the -f parameter.
Default is the value of the 'sendemail.envelopesender' configuration
variable; if that is unspecified, choosing the envelope sender is left
to your MTA.
--to:: --[no-]validate::
Specify the primary recipient of the emails generated. Perform sanity checks on patches.
Generally, this will be the upstream maintainer of the Currently, validation means the following:
project involved.
Default is the value of the 'sendemail.to' configuration value;
if that is unspecified, this will be prompted for.
+ +
The --to option must be repeated for each user you want on the to list. --
* Warn of patches that contain lines longer than 998 characters; this
is due to SMTP limits as described by http://www.ietf.org/rfc/rfc2821.txt.
--
+
Default is the value of 'sendemail.validate'; if this is not set,
default to '--validate'.
CONFIGURATION CONFIGURATION
------------- -------------
sendemail.identity::
The default configuration identity. When specified,
'sendemail.<identity>.<item>' will have higher precedence than
'sendemail.<item>'. This is useful to declare multiple SMTP
identities and to hoist sensitive authentication information
out of the repository and into the global configuration file.
sendemail.aliasesfile:: sendemail.aliasesfile::
To avoid typing long email addresses, point this to one or more To avoid typing long email addresses, point this to one or more
@ -210,38 +204,6 @@ sendemail.aliasfiletype::
Format of the file(s) specified in sendemail.aliasesfile. Must be Format of the file(s) specified in sendemail.aliasesfile. Must be
one of 'mutt', 'mailrc', 'pine', or 'gnus'. one of 'mutt', 'mailrc', 'pine', or 'gnus'.
sendemail.to::
Email address (or alias) to always send to.
sendemail.cccmd::
Command to execute to generate per patch file specific "Cc:"s.
sendemail.bcc::
Email address (or alias) to always bcc.
sendemail.chainreplyto::
Boolean value specifying the default to the '--chain_reply_to'
parameter.
sendemail.smtpserver::
Default SMTP server to use.
sendemail.smtpserverport::
Default SMTP server port to use.
sendemail.smtpuser::
Default SMTP-AUTH username.
sendemail.smtppass::
Default SMTP-AUTH password.
sendemail.smtpencryption::
Default encryption method. Use 'ssl' for SSL (and specify an
appropriate port), or 'tls' for TLS. Takes precedence over
'smtpssl' if both are specified.
sendemail.smtpssl::
Legacy boolean that sets 'smtpencryption=ssl' if enabled.
Author Author
------ ------
@ -250,10 +212,12 @@ Written by Ryan Anderson <ryan@michonline.com>
git-send-email is originally based upon git-send-email is originally based upon
send_lots_of_email.pl by Greg Kroah-Hartman. send_lots_of_email.pl by Greg Kroah-Hartman.
Documentation Documentation
-------------- --------------
Documentation by Ryan Anderson Documentation by Ryan Anderson
GIT GIT
--- ---
Part of the linkgit:git[1] suite Part of the linkgit:git[1] suite

Просмотреть файл

@ -1123,7 +1123,8 @@ _git_send_email ()
--no-suppress-from --no-thread --quiet --no-suppress-from --no-thread --quiet
--signed-off-by-cc --smtp-pass --smtp-server --signed-off-by-cc --smtp-pass --smtp-server
--smtp-server-port --smtp-ssl --smtp-user --subject --smtp-server-port --smtp-ssl --smtp-user --subject
--suppress-cc --suppress-from --thread --to" --suppress-cc --suppress-from --thread --to
--validate --no-validate"
return return
;; ;;
esac esac

Просмотреть файл

@ -39,75 +39,40 @@ package main;
sub usage { sub usage {
print <<EOT; print <<EOT;
git send-email [options] <file | directory>... git send-email [options] <file | directory>...
Options:
--from Specify the "From:" line of the email to be sent.
--to Specify the primary "To:" line of the email. Composing:
--from <str> * Email From:
--to <str> * Email To:
--cc <str> * Email Cc:
--bcc <str> * Email Bcc:
--subject <str> * Email "Subject:"
--in-reply-to <str> * Email "In-Reply-To:"
--compose * Open an editor for introduction.
--cc Specify an initial "Cc:" list for the entire series Sending:
of emails. --envelope-sender <str> * Email envelope sender.
--smtp-server <str:int> * Outgoing SMTP server to use. The port
is optional. Default 'localhost'.
--smtp-server-port <int> * Outgoing SMTP server port.
--smtp-user <str> * Username for SMTP-AUTH.
--smtp-pass <str> * Password for SMTP-AUTH; not necessary.
--smtp-encryption <str> * tls or ssl; anything else disables.
--smtp-ssl * Deprecated. Use '--smtp-encryption ssl'.
--cc-cmd Specify a command to execute per file which adds Automating:
per file specific cc address entries --identity <str> * Use the sendemail.<id> options.
--cc-cmd <str> * Email Cc: via `<str> \$patch_path`
--suppress-cc <str> * author, self, sob, cccmd, all.
--[no-]signed-off-by-cc * Send to Cc: and Signed-off-by:
addresses. Default on.
--[no-]suppress-from * Send to self. Default off.
--[no-]chain-reply-to * Chain In-Reply-To: fields. Default on.
--[no-]thread * Use In-Reply-To: field. Default on.
--bcc Specify a list of email addresses that should be Bcc: Administering:
on all the emails. --quiet * Output one line of info per email.
--dry-run * Don't actually send the emails.
--compose Use \$GIT_EDITOR, core.editor, \$EDITOR, or \$VISUAL to edit --[no-]validate * Perform patch sanity checks. Default on.
an introductory message for the patch series.
--subject Specify the initial "Subject:" line.
Only necessary if --compose is also set. If --compose
is not set, this will be prompted for.
--in-reply-to Specify the first "In-Reply-To:" header line.
Only used if --compose is also set. If --compose is not
set, this will be prompted for.
--chain-reply-to If set, the replies will all be to the previous
email sent, rather than to the first email sent.
Defaults to on.
--signed-off-cc Automatically add email addresses that appear in
Signed-off-by: or Cc: lines to the cc: list. Defaults to on.
--identity The configuration identity, a subsection to prioritise over
the default section.
--smtp-server If set, specifies the outgoing SMTP server to use.
Defaults to localhost. Port number can be specified here with
hostname:port format or by using --smtp-server-port option.
--smtp-server-port Specify a port on the outgoing SMTP server to connect to.
--smtp-user The username for SMTP-AUTH.
--smtp-pass The password for SMTP-AUTH.
--smtp-encryption Specify 'tls' for STARTTLS encryption, or 'ssl' for SSL.
Any other value disables the feature.
--smtp-ssl Synonym for '--smtp-encryption=ssl'. Deprecated.
--suppress-cc Suppress the specified category of auto-CC. The category
can be one of 'author' for the patch author, 'self' to
avoid copying yourself, 'sob' for Signed-off-by lines,
'cccmd' for the output of the cccmd, or 'all' to suppress
all of these.
--suppress-from Suppress sending emails to yourself. Defaults to off.
--thread Specify that the "In-Reply-To:" header should be set on all
emails. Defaults to on.
--quiet Make git-send-email less verbose. One line per email
should be all that is output.
--dry-run Do everything except actually send the emails.
--envelope-sender Specify the envelope sender used to send the emails.
--no-validate Don't perform any sanity checks on patches.
EOT EOT
exit(1); exit(1);
@ -186,17 +151,19 @@ if ($@) {
my ($quiet, $dry_run) = (0, 0); my ($quiet, $dry_run) = (0, 0);
# Variables with corresponding config settings # Variables with corresponding config settings
my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd); my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption); my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts); my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
my ($no_validate); my ($validate);
my (@suppress_cc); my (@suppress_cc);
my %config_bool_settings = ( my %config_bool_settings = (
"thread" => [\$thread, 1], "thread" => [\$thread, 1],
"chainreplyto" => [\$chain_reply_to, 1], "chainreplyto" => [\$chain_reply_to, 1],
"suppressfrom" => [\$suppress_from, undef], "suppressfrom" => [\$suppress_from, undef],
"signedoffcc" => [\$signed_off_cc, undef], "signedoffbycc" => [\$signed_off_by_cc, undef],
"signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
"validate" => [\$validate, 1],
); );
my %config_settings = ( my %config_settings = (
@ -259,11 +226,11 @@ my $rc = GetOptions("sender|from=s" => \$sender,
"cc-cmd=s" => \$cc_cmd, "cc-cmd=s" => \$cc_cmd,
"suppress-from!" => \$suppress_from, "suppress-from!" => \$suppress_from,
"suppress-cc=s" => \@suppress_cc, "suppress-cc=s" => \@suppress_cc,
"signed-off-cc|signed-off-by-cc!" => \$signed_off_cc, "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
"dry-run" => \$dry_run, "dry-run" => \$dry_run,
"envelope-sender=s" => \$envelope_sender, "envelope-sender=s" => \$envelope_sender,
"thread!" => \$thread, "thread!" => \$thread,
"no-validate" => \$no_validate, "validate!" => \$validate,
); );
unless ($rc) { unless ($rc) {
@ -335,7 +302,7 @@ if ($suppress_cc{'all'}) {
# If explicit old-style ones are specified, they trump --suppress-cc. # If explicit old-style ones are specified, they trump --suppress-cc.
$suppress_cc{'self'} = $suppress_from if defined $suppress_from; $suppress_cc{'self'} = $suppress_from if defined $suppress_from;
$suppress_cc{'sob'} = !$signed_off_cc if defined $signed_off_cc; $suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;
# Debugging, print out the suppressions. # Debugging, print out the suppressions.
if (0) { if (0) {
@ -416,7 +383,7 @@ for my $f (@ARGV) {
} }
} }
if (!$no_validate) { if ($validate) {
foreach my $f (@files) { foreach my $f (@files) {
unless (-p $f) { unless (-p $f) {
my $error = validate_patch($f); my $error = validate_patch($f);