git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc
@ 2007-06-27  6:53 Adam Roben
  2007-06-27  6:53 ` [PATCH 2/2] git-send-email: Add --thread option Adam Roben
  2007-06-27 23:47 ` [PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc Adam Roben
  0 siblings, 2 replies; 3+ messages in thread
From: Adam Roben @ 2007-06-27  6:53 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Adam Roben

This change makes git-send-email's behavior easier to modify by adding config
equivalents for two more of git-send-email's flags.

The mapping of flag to config setting is:
--[no-]supress-from => sendemail.suppressfrom
--[no-]signed-off-cc => sendemail.signedoffcc

Signed-off-by: Adam Roben <aroben@apple.com>
---
 Thanks to Junio for the suggestion for how to clean up the default values.

 Documentation/git-send-email.txt |   16 ++++++++++------
 git-send-email.perl              |   34 +++++++++++++++++++++-------------
 2 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 946bd76..01bbd18 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -59,9 +59,11 @@ The --cc option must be repeated for each user you want on the cc list.
 	Only necessary if --compose is also set.  If --compose
 	is not set, this will be prompted for.
 
---no-signed-off-by-cc::
-	Do not add emails found in Signed-off-by: or Cc: lines to the
-	cc list.
+--signed-off-by-cc, --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.
 
 --quiet::
 	Make git-send-email less verbose.  One line per email should be
@@ -82,9 +84,11 @@ The --cc option must be repeated for each user you want on the cc list.
 	Only necessary if --compose is also set.  If --compose
 	is not set, this will be prompted for.
 
---suppress-from::
-	Do not add the From: address to the cc: list, if it shows up in a From:
-	line.
+--suppress-from, --no-suppress-from::
+        If this is set, do not add the From: address to the cc: list, if it
+        shows up in a From: line.
+        Default is the value of 'sendemail.suppressfrom' configuration value;
+        if that is unspecified, default to --no-supress-from.
 
 --dry-run::
 	Do everything except actually send the emails.
diff --git a/git-send-email.perl b/git-send-email.perl
index 9f75551..584eda9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -64,15 +64,14 @@ Options:
                   email sent, rather than to the first email sent.
                   Defaults to on.
 
-   --no-signed-off-cc Suppress the automatic addition of email addresses
-                 that appear in Signed-off-by: or Cc: lines to the cc:
-                 list.  Note: Using this option is not recommended.
+   --signed-off-cc Automatically add email addresses that appear in
+                 Signed-off-by: or Cc: lines to the cc: list. Defaults to on.
 
    --smtp-server  If set, specifies the outgoing SMTP server to use.
                   Defaults to localhost.
 
    --suppress-from Suppress sending emails to yourself if your address
-                  appears in a From: line.
+                  appears in a From: line. Defaults to off.
 
    --quiet	  Make git-send-email less verbose.  One line per email
                   should be all that is output.
@@ -137,9 +136,6 @@ my $compose_filename = ".msg.$$";
 my (@to,@cc,@initial_cc,@bcclist,@xh,
 	$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
 
-# Behavior modification variables
-my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
-	$dry_run) = (1, 0, 0, 0, 0);
 my $smtp_server;
 my $envelope_sender;
 
@@ -154,9 +150,21 @@ if ($@) {
 	$term = new FakeTerm "$@: going non-interactive";
 }
 
-my $def_chain = $repo->config_bool('sendemail.chainreplyto');
-if (defined $def_chain and not $def_chain) {
-    $chain_reply_to = 0;
+# Behavior modification variables
+my ($quiet, $dry_run) = (0, 0);
+
+# Variables with corresponding config settings
+my ($chain_reply_to, $suppress_from, $signed_off_cc);
+
+my %config_settings = (
+    "chainreplyto" => [\$chain_reply_to, 1],
+    "suppressfrom" => [\$suppress_from, 0],
+    "signedoffcc" => [\$signed_off_cc, 1],
+);
+
+foreach my $setting (keys %config_settings) {
+    my $config = $repo->config_bool("sendemail.$setting");
+    ${$config_settings{$setting}->[0]} = (defined $config) ? $config : $config_settings{$setting}->[1];
 }
 
 @bcclist = $repo->config('sendemail.bcc');
@@ -177,8 +185,8 @@ my $rc = GetOptions("from=s" => \$from,
 		    "smtp-server=s" => \$smtp_server,
 		    "compose" => \$compose,
 		    "quiet" => \$quiet,
-		    "suppress-from" => \$suppress_from,
-		    "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
+		    "suppress-from!" => \$suppress_from,
+		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 	 );
@@ -609,7 +617,7 @@ foreach my $t (@files) {
 			}
 		} else {
 			$message .=  $_;
-			if (/^(Signed-off-by|Cc): (.*)$/i && !$no_signed_off_cc) {
+			if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
 				my $c = $2;
 				chomp $c;
 				push @cc, $c;
-- 
1.5.2.2.551.ga811

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] git-send-email: Add --thread option
  2007-06-27  6:53 [PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc Adam Roben
@ 2007-06-27  6:53 ` Adam Roben
  2007-06-27 23:47 ` [PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc Adam Roben
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Roben @ 2007-06-27  6:53 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Adam Roben

The --thread option controls whether the In-Reply-To header will be set on
any emails sent. The current behavior is to always set this header, so this
option is most useful in its negated form, --no-thread. This behavior can
also be controlled through the 'sendemail.threaded' config setting.

Signed-off-by: Adam Roben <aroben@apple.com>
---
 Apologies to Junio, Matthias, and Julian, who had to endure a spamming from me
 in the development of this patch.

 Documentation/git-send-email.txt |    7 +++++++
 git-send-email.perl              |   11 ++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 01bbd18..293686c 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -90,6 +90,13 @@ The --cc option must be repeated for each user you want on the cc list.
         Default is the value of 'sendemail.suppressfrom' configuration value;
         if that is unspecified, default to --no-supress-from.
 
+--thread, --no-thread::
+	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
+	header set.
+	Default is the value of the 'sendemail.thread' configuration value;
+	if that is unspecified, default to --thread.
+
 --dry-run::
 	Do everything except actually send the emails.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index 584eda9..28659f8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -73,6 +73,9 @@ Options:
    --suppress-from Suppress sending emails to yourself if your address
                   appears in a From: line. 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.
 
@@ -154,9 +157,10 @@ if ($@) {
 my ($quiet, $dry_run) = (0, 0);
 
 # Variables with corresponding config settings
-my ($chain_reply_to, $suppress_from, $signed_off_cc);
+my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc);
 
 my %config_settings = (
+    "thread" => [\$thread, 1],
     "chainreplyto" => [\$chain_reply_to, 1],
     "suppressfrom" => [\$suppress_from, 0],
     "signedoffcc" => [\$signed_off_cc, 1],
@@ -189,6 +193,7 @@ my $rc = GetOptions("from=s" => \$from,
 		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
+		    "thread!" => \$thread,
 	 );
 
 unless ($rc) {
@@ -295,7 +300,7 @@ if (!defined $initial_subject && $compose) {
 	$prompting++;
 }
 
-if (!defined $initial_reply_to && $prompting) {
+if ($thread && !defined $initial_reply_to && $prompting) {
 	do {
 		$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
 			$initial_reply_to);
@@ -492,7 +497,7 @@ Date: $date
 Message-Id: $message_id
 X-Mailer: git-send-email $gitversion
 ";
-	if ($reply_to) {
+	if ($thread && $reply_to) {
 
 		$header .= "In-Reply-To: $reply_to\n";
 		$header .= "References: $references\n";
-- 
1.5.2.2.551.ga811

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc
  2007-06-27  6:53 [PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc Adam Roben
  2007-06-27  6:53 ` [PATCH 2/2] git-send-email: Add --thread option Adam Roben
@ 2007-06-27 23:47 ` Adam Roben
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Roben @ 2007-06-27 23:47 UTC (permalink / raw)
  To: Adam Roben; +Cc: git, Junio C Hamano

    Junio, I see that you applied my previous patch to master before I  
sent these two new ones that replace it. Would you like me to redo  
these patches based on master, or will you revert the old patch and  
apply these? I'm happy either way. Thanks!

-Adam

On Jun 26, 2007, at 11:53 PM, Adam Roben wrote:

> This change makes git-send-email's behavior easier to modify by  
> adding config
> equivalents for two more of git-send-email's flags.
>
> The mapping of flag to config setting is:
> --[no-]supress-from => sendemail.suppressfrom
> --[no-]signed-off-cc => sendemail.signedoffcc
>
> Signed-off-by: Adam Roben <aroben@apple.com>
> ---
> Thanks to Junio for the suggestion for how to clean up the default  
> values.
>
> Documentation/git-send-email.txt |   16 ++++++++++------
> git-send-email.perl              |   34 ++++++++++++++++++++ 
> +-------------
> 2 files changed, 31 insertions(+), 19 deletions(-)
>
> diff --git a/Documentation/git-send-email.txt b/Documentation/git- 
> send-email.txt
> index 946bd76..01bbd18 100644
> --- a/Documentation/git-send-email.txt
> +++ b/Documentation/git-send-email.txt
> @@ -59,9 +59,11 @@ The --cc option must be repeated for each user  
> you want on the cc list.
> 	Only necessary if --compose is also set.  If --compose
> 	is not set, this will be prompted for.
>
> ---no-signed-off-by-cc::
> -	Do not add emails found in Signed-off-by: or Cc: lines to the
> -	cc list.
> +--signed-off-by-cc, --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.
>
> --quiet::
> 	Make git-send-email less verbose.  One line per email should be
> @@ -82,9 +84,11 @@ The --cc option must be repeated for each user  
> you want on the cc list.
> 	Only necessary if --compose is also set.  If --compose
> 	is not set, this will be prompted for.
>
> ---suppress-from::
> -	Do not add the From: address to the cc: list, if it shows up in a  
> From:
> -	line.
> +--suppress-from, --no-suppress-from::
> +        If this is set, do not add the From: address to the cc:  
> list, if it
> +        shows up in a From: line.
> +        Default is the value of 'sendemail.suppressfrom'  
> configuration value;
> +        if that is unspecified, default to --no-supress-from.
>
> --dry-run::
> 	Do everything except actually send the emails.
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 9f75551..584eda9 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -64,15 +64,14 @@ Options:
>                   email sent, rather than to the first email sent.
>                   Defaults to on.
>
> -   --no-signed-off-cc Suppress the automatic addition of email  
> addresses
> -                 that appear in Signed-off-by: or Cc: lines to the  
> cc:
> -                 list.  Note: Using this option is not recommended.
> +   --signed-off-cc Automatically add email addresses that appear in
> +                 Signed-off-by: or Cc: lines to the cc: list.  
> Defaults to on.
>
>    --smtp-server  If set, specifies the outgoing SMTP server to use.
>                   Defaults to localhost.
>
>    --suppress-from Suppress sending emails to yourself if your address
> -                  appears in a From: line.
> +                  appears in a From: line. Defaults to off.
>
>    --quiet	  Make git-send-email less verbose.  One line per email
>                   should be all that is output.
> @@ -137,9 +136,6 @@ my $compose_filename = ".msg.$$";
> my (@to,@cc,@initial_cc,@bcclist,@xh,
> 	$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
>
> -# Behavior modification variables
> -my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
> -	$dry_run) = (1, 0, 0, 0, 0);
> my $smtp_server;
> my $envelope_sender;
>
> @@ -154,9 +150,21 @@ if ($@) {
> 	$term = new FakeTerm "$@: going non-interactive";
> }
>
> -my $def_chain = $repo->config_bool('sendemail.chainreplyto');
> -if (defined $def_chain and not $def_chain) {
> -    $chain_reply_to = 0;
> +# Behavior modification variables
> +my ($quiet, $dry_run) = (0, 0);
> +
> +# Variables with corresponding config settings
> +my ($chain_reply_to, $suppress_from, $signed_off_cc);
> +
> +my %config_settings = (
> +    "chainreplyto" => [\$chain_reply_to, 1],
> +    "suppressfrom" => [\$suppress_from, 0],
> +    "signedoffcc" => [\$signed_off_cc, 1],
> +);
> +
> +foreach my $setting (keys %config_settings) {
> +    my $config = $repo->config_bool("sendemail.$setting");
> +    ${$config_settings{$setting}->[0]} = (defined $config) ?  
> $config : $config_settings{$setting}->[1];
> }
>
> @bcclist = $repo->config('sendemail.bcc');
> @@ -177,8 +185,8 @@ my $rc = GetOptions("from=s" => \$from,
> 		    "smtp-server=s" => \$smtp_server,
> 		    "compose" => \$compose,
> 		    "quiet" => \$quiet,
> -		    "suppress-from" => \$suppress_from,
> -		    "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
> +		    "suppress-from!" => \$suppress_from,
> +		    "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
> 		    "dry-run" => \$dry_run,
> 		    "envelope-sender=s" => \$envelope_sender,
> 	 );
> @@ -609,7 +617,7 @@ foreach my $t (@files) {
> 			}
> 		} else {
> 			$message .=  $_;
> -			if (/^(Signed-off-by|Cc): (.*)$/i && !$no_signed_off_cc) {
> +			if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
> 				my $c = $2;
> 				chomp $c;
> 				push @cc, $c;
> -- 
> 1.5.2.2.551.ga811
>
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-27 23:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-27  6:53 [PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc Adam Roben
2007-06-27  6:53 ` [PATCH 2/2] git-send-email: Add --thread option Adam Roben
2007-06-27 23:47 ` [PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc Adam Roben

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).