git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-send-email: Add --threaded option
@ 2007-06-26 22:48 Adam Roben
  2007-06-27  5:21 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Roben @ 2007-06-26 22:48 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Adam Roben

The --threaded 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-threaded. This behavior can
also be controlled through the 'sendemail.threaded' config setting.

Signed-off-by: Adam Roben <aroben@apple.com>
---
 Documentation/git-send-email.txt |    7 +++++++
 git-send-email.perl              |   25 ++++++++++++++++++-------
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 946bd76..1f5d57d 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -86,6 +86,13 @@ The --cc option must be repeated for each user you want on the cc list.
 	Do not add the From: address to the cc: list, if it shows up in a From:
 	line.
 
+--threaded, --no-threaded::
+	If this is set, the In-Reply-To header will be set on each email sent.
+	If disabled with "--no-threaded", no emails will have the In-Reply-To
+	header set.
+	Default is the value of the 'sendemail.threaded' configuration value;
+	if that is unspecified, default to --threaded.
+
 --dry-run::
 	Do everything except actually send the emails.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index 9f75551..b8b8fe7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -74,6 +74,9 @@ Options:
    --suppress-from Suppress sending emails to yourself if your address
                   appears in a From: line.
 
+    --threaded    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.
 
@@ -138,8 +141,8 @@ 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 ($threaded, $chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
+	$dry_run) = (1, 1, 0, 0, 0, 0);
 my $smtp_server;
 my $envelope_sender;
 
@@ -154,9 +157,16 @@ 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;
+my %config_settings = (
+    "threaded" => \$threaded,
+    "chainreplyto" => \$chain_reply_to,
+);
+
+foreach my $setting (keys %config_settings) {
+    my $default = $repo->config_bool("sendemail.$setting");
+    if (defined $default) {
+        $config_settings{$setting} = $default ? 1 : 0;
+    }
 }
 
 @bcclist = $repo->config('sendemail.bcc');
@@ -181,6 +191,7 @@ my $rc = GetOptions("from=s" => \$from,
 		    "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
+		    "threaded!" => \$threaded,
 	 );
 
 unless ($rc) {
@@ -287,7 +298,7 @@ if (!defined $initial_subject && $compose) {
 	$prompting++;
 }
 
-if (!defined $initial_reply_to && $prompting) {
+if ($threaded && !defined $initial_reply_to && $prompting) {
 	do {
 		$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
 			$initial_reply_to);
@@ -484,7 +495,7 @@ Date: $date
 Message-Id: $message_id
 X-Mailer: git-send-email $gitversion
 ";
-	if ($reply_to) {
+	if ($threaded && $reply_to) {
 
 		$header .= "In-Reply-To: $reply_to\n";
 		$header .= "References: $references\n";
-- 
1.5.2.2.549.gaeb59-dirty

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

* [PATCH] git-send-email: Add --threaded option
@ 2007-06-26 22:57 Adam Roben
  0 siblings, 0 replies; 5+ messages in thread
From: Adam Roben @ 2007-06-26 22:57 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Adam Roben

The --threaded 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-threaded. This behavior can
also be controlled through the 'sendemail.threaded' config setting.

Signed-off-by: Adam Roben <aroben@apple.com>
---
 Documentation/git-send-email.txt |    7 +++++++
 git-send-email.perl              |   25 ++++++++++++++++++-------
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 946bd76..1f5d57d 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -86,6 +86,13 @@ The --cc option must be repeated for each user you want on the cc list.
 	Do not add the From: address to the cc: list, if it shows up in a From:
 	line.
 
+--threaded, --no-threaded::
+	If this is set, the In-Reply-To header will be set on each email sent.
+	If disabled with "--no-threaded", no emails will have the In-Reply-To
+	header set.
+	Default is the value of the 'sendemail.threaded' configuration value;
+	if that is unspecified, default to --threaded.
+
 --dry-run::
 	Do everything except actually send the emails.
 
diff --git a/git-send-email.perl b/git-send-email.perl
index 9f75551..b8b8fe7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -74,6 +74,9 @@ Options:
    --suppress-from Suppress sending emails to yourself if your address
                   appears in a From: line.
 
+    --threaded    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.
 
@@ -138,8 +141,8 @@ 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 ($threaded, $chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
+	$dry_run) = (1, 1, 0, 0, 0, 0);
 my $smtp_server;
 my $envelope_sender;
 
@@ -154,9 +157,16 @@ 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;
+my %config_settings = (
+    "threaded" => \$threaded,
+    "chainreplyto" => \$chain_reply_to,
+);
+
+foreach my $setting (keys %config_settings) {
+    my $default = $repo->config_bool("sendemail.$setting");
+    if (defined $default) {
+        $config_settings{$setting} = $default ? 1 : 0;
+    }
 }
 
 @bcclist = $repo->config('sendemail.bcc');
@@ -181,6 +191,7 @@ my $rc = GetOptions("from=s" => \$from,
 		    "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
+		    "threaded!" => \$threaded,
 	 );
 
 unless ($rc) {
@@ -287,7 +298,7 @@ if (!defined $initial_subject && $compose) {
 	$prompting++;
 }
 
-if (!defined $initial_reply_to && $prompting) {
+if ($threaded && !defined $initial_reply_to && $prompting) {
 	do {
 		$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
 			$initial_reply_to);
@@ -484,7 +495,7 @@ Date: $date
 Message-Id: $message_id
 X-Mailer: git-send-email $gitversion
 ";
-	if ($reply_to) {
+	if ($threaded && $reply_to) {
 
 		$header .= "In-Reply-To: $reply_to\n";
 		$header .= "References: $references\n";
-- 
1.5.2.2.549.gaeb59-dirty

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

* Re: [PATCH] git-send-email: Add --threaded option
  2007-06-26 22:48 Adam Roben
@ 2007-06-27  5:21 ` Junio C Hamano
  2007-06-27  5:32   ` Adam Roben
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2007-06-27  5:21 UTC (permalink / raw)
  To: Adam Roben; +Cc: git

Adam Roben <aroben@apple.com> writes:

> The --threaded 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-threaded. This behavior can
> also be controlled through the 'sendemail.threaded' config setting.
>
> Signed-off-by: Adam Roben <aroben@apple.com>

Thanks.  I've always felt that send-email has too much built-in
policy; I think this is a sensible change.

> @@ -138,8 +141,8 @@ 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 ($threaded, $chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
> +	$dry_run) = (1, 1, 0, 0, 0, 0);

While we are at it, you might want to make everything other than
quiet and dry_run overridable the same way.

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

* Re: [PATCH] git-send-email: Add --threaded option
  2007-06-27  5:21 ` Junio C Hamano
@ 2007-06-27  5:32   ` Adam Roben
  2007-06-27  6:03     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Roben @ 2007-06-27  5:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Jun 26, 2007, at 10:21 PM, Junio C Hamano wrote:

> Adam Roben <aroben@apple.com> writes:
>
>> @@ -138,8 +141,8 @@ 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 ($threaded, $chain_reply_to, $quiet, $suppress_from,  
>> $no_signed_off_cc,
>> +	$dry_run) = (1, 1, 0, 0, 0, 0);
>
> While we are at it, you might want to make everything other than
> quiet and dry_run overridable the same way.

    --[no-]chain-reply-to, --suppress-from and --no-signed-off-cc  
already exist, so do you mean that we should support --no-suppress- 
from and --signed-off-cc (i.e., the negations) as well? Or that we  
should have equivalent config settings for these? Or both?

    I also realized after sending this that git-format-patch has a -- 
[no-]thread option, so I think I'll change the name of this option to  
match.

-Adam

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

* Re: [PATCH] git-send-email: Add --threaded option
  2007-06-27  5:32   ` Adam Roben
@ 2007-06-27  6:03     ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2007-06-27  6:03 UTC (permalink / raw)
  To: Adam Roben; +Cc: git

Adam Roben <aroben@apple.com> writes:

> On Jun 26, 2007, at 10:21 PM, Junio C Hamano wrote:
> ...
>>> +my ($threaded, $chain_reply_to, $quiet, $suppress_from,
>>> $no_signed_off_cc,
>>> +	$dry_run) = (1, 1, 0, 0, 0, 0);
>>
>> While we are at it, you might want to make everything other than
>> quiet and dry_run overridable the same way.
>
>    --[no-]chain-reply-to, --suppress-from and --no-signed-off-cc
> already exist, so do you mean that we should support --no-suppress-
> from and --signed-off-cc (i.e., the negations) as well? Or that we
> should have equivalent config settings for these? Or both?

Sorry for being unclear; I was talking about the config.

Also "my ($a, $b, $c, ...) = ($defA, $defB, $defC, ...)" gets
extremely hard to read when the list grows longer.  I was hoping
that when adding entries to %config_settings array, you would do
something like:

	my %config_settings = (
                threaded => [\threaded, 1],
                chainreplyto => [\chain_reply_to, 1],
		...
	);
	while (my ($var, $data) = each %config_settings) {
        	my $config = $repo_config_bool("sendemail.$var);
		${$data->[0]} = (defined $config) ? $config : $data->[1];
	}

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-26 22:57 [PATCH] git-send-email: Add --threaded option Adam Roben
  -- strict thread matches above, loose matches on Subject: below --
2007-06-26 22:48 Adam Roben
2007-06-27  5:21 ` Junio C Hamano
2007-06-27  5:32   ` Adam Roben
2007-06-27  6:03     ` Junio C Hamano

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).