git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: Rafael Aquini <aquini@redhat.com>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH v2] send-email: restore --in-reply-to superseding behavior
Date: Wed, 1 Jul 2020 15:10:07 -0700	[thread overview]
Message-ID: <20200701221007.GA49195@Carlos-MBP> (raw)
In-Reply-To: <20200629141104.2522011-1-aquini@redhat.com>

On Mon, Jun 29, 2020 at 10:11:04AM -0400, Rafael Aquini wrote:
> 
> This patch fixes the aformentioned issue, by bringing --in-reply-to's old
> overriding behavior back.
> 
> Fixes: 256be1d3f0 (send-email: avoid duplicate In-Reply-To/References, 2018-04-17)

the following test case could be squashed on top to make the regression more
visible IMHO (it at least pass when applied on top of v2.17.1 and also
ra/send-email-in-reply-to-from-command-line-wins)

--- 8< ---
 t/t9001-send-email.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 90f61c3400..ec261085ec 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -42,7 +42,8 @@ clean_fake_sendmail () {
 }
 
 test_expect_success $PREREQ 'Extract patches' '
-	patches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1)
+	patches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1) &&
+	threaded_patches=$(git format-patch -o threaded -s --in-reply-to="format" HEAD^1)
 '
 
 # Test no confirm early to ensure remaining tests will not hang
@@ -1219,6 +1220,17 @@ test_expect_success $PREREQ 'threading but no chain-reply-to' '
 	grep "In-Reply-To: " stdout
 '
 
+test_expect_success $PREREQ 'override in-reply-to if no threading' '
+	git send-email \
+		--dry-run \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--no-thread \
+		--in-reply-to="override" \
+		$threaded_patches >stdout &&
+	grep "In-Reply-To: <override>" stdout
+'
+
 test_expect_success $PREREQ 'sendemail.to works' '
 	git config --replace-all sendemail.to "Somebody <somebody@ex.com>" &&
 	git send-email \

base-commit: 096547052491426a29e040a5bd94d7f8a4cab8ac
--- >8 ---

> diff --git a/git-send-email.perl b/git-send-email.perl
> index dc95656f75..36c47bae1d 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1699,10 +1699,14 @@ sub process_file {
>  				$xfer_encoding = $1 if not defined $xfer_encoding;
>  			}
>  			elsif (/^In-Reply-To: (.*)/i) {
> -				$in_reply_to = $1;
> +				if (!$initial_in_reply_to || $thread) {
> +					$in_reply_to = $1;
> +				}
>  			}
>  			elsif (/^References: (.*)/i) {
> -				$references = $1;
> +				if (!$initial_in_reply_to || $thread) {
> +					$references = $1;
> +				}
>  			}
>  			elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) {
>  				push @xh, $_;

in both cases, doing `!defined $initial_in_reply_to` might seem like a
more consistent option.

Carlo

      reply	other threads:[~2020-07-01 22:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24 19:55 [PATCH] send-email: restore --in-reply-to superseding behavior Rafael Aquini
2020-06-24 21:33 ` Junio C Hamano
2020-06-24 23:45   ` Rafael Aquini
2020-06-25 18:47     ` Rafael Aquini
2020-06-26  1:08       ` Carlo Arenas
2020-06-26 13:39         ` Rafael Aquini
2020-06-29 14:11   ` [PATCH v2] " Rafael Aquini
2020-07-01 22:10     ` Carlo Marcelo Arenas Belón [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200701221007.GA49195@Carlos-MBP \
    --to=carenas@gmail.com \
    --cc=aquini@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).