From: Jeff King <peff@peff.net>
To: "Marvin Häuser" <mhaeuser@posteo.de>
Cc: git@vger.kernel.org
Subject: Re: [BUG] send-email propagates "In-Reply-To"
Date: Mon, 23 Aug 2021 14:27:36 -0400 [thread overview]
Message-ID: <YSPomC95hxZZTHRe@coredump.intra.peff.net> (raw)
In-Reply-To: <5cd5a58b-ac9e-4628-a8d3-836b1f795732@posteo.de>
On Mon, Aug 23, 2021 at 05:44:32PM +0000, Marvin Häuser wrote:
> > Your patch looks like the right direction. Handling $references at the
> > same time is the right thing to do. The extra setting of $subject seems
> > weird, though.
>
> Basically the idea is to either 1) advance the values (for threading)
> or 2) reset them to their defaults, i.e. never just preserve them. I
> neither know Perl nor the git design well, so I just applied the
> pattern to the subject as well. Should I just drop it? What would be
> the potential issues with enforcing the pattern?
I'm not all that familiar with the innards of git-send-email.perl
either. Looking closer, I see $subject is indeed declared outside of the
regular loop, so it would need to be reset (just like $message_id is). I
guess nobody noticed because patches almost always have their own
"Subject:" header, which would override it.
But either that should go into its own patch, or the commit message
should be modified to explain that it is covering not just
in-reply-to/references, but we think this fixes all similar variables.
> > We'd want to add a test to t/t9001-send-email.sh, too, I'd think.
>
> I'm not home and I might need a few days to look into this. Any
> helping hand is greatly appreciated. :)
You'd want something like the patch below (and possibly something
similar for the $subject handling).
Both of the new tests fail without your patch and pass with it, but:
- note the weird behavior I found with --in-reply-to; this is
something we might want to address at the same time
- applying your patch fails the earlier t9001.52 ("In-Reply-To without
--chain-reply-to"). I didn't dig into what's going on there.
---
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 57fc10e7f8..747872d5be 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -2227,6 +2227,56 @@ test_expect_success $PREREQ 'test shell expression with --sendmail-cmd' '
test_path_is_file commandline1
'
+test_expect_success $PREREQ 'set up in-reply-to/references patches' '
+ cat >has-reply.patch <<-\EOF &&
+ From: A U Thor <author@example.com>
+ Subject: patch with in-reply-to
+ Message-ID: <patch.with.in.reply.to@example.com>
+ In-Reply-To: <replied.to@example.com>
+ References: <replied.to@example.com>
+
+ This is the body.
+ EOF
+ cat >no-reply.patch <<-\EOF
+ From: A U Thor <author@example.com>
+ Subject: patch without in-reply-to
+ Message-ID: <patch.without.in.reply.to@example.com>
+
+ This is the body.
+ EOF
+'
+
+test_expect_success $PREREQ 'patch reply headers not carried over with --no-thread' '
+ clean_fake_sendmail &&
+ git send-email \
+ --no-thread \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ has-reply.patch no-reply.patch &&
+ grep "In-Reply-To: <replied.to@example.com>" msgtxt1 &&
+ grep "References: <replied.to@example.com>" msgtxt1 &&
+ ! grep replied.to@example.com msgtxt2
+'
+
+test_expect_success $PREREQ 'cmdline in-reply-to used with --no-thread' '
+ clean_fake_sendmail &&
+ git send-email \
+ --no-thread \
+ --in-reply-to="<cmdline.reply@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ has-reply.patch no-reply.patch &&
+ # what should happen with has-reply.patch here? The
+ # current behavior seems to throw away its in-file
+ # in-reply-to entirely in favor of the command line
+ # one. That seems like a bug?
+ #
+ # But definitely the second message should get the cmdline
+ # value, and not be empty.
+ grep "In-Reply-To: <cmdline.reply@example.com>" msgtxt2 &&
+ grep "References: <cmdline.reply@example.com>" msgtxt2
+'
+
test_expect_success $PREREQ 'invoke hook' '
mkdir -p .git/hooks &&
next prev parent reply other threads:[~2021-08-23 18:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-22 9:24 [BUG] send-email propagates "In-Reply-To" Marvin Häuser
2021-08-22 12:11 ` Bagas Sanjaya
2021-08-23 16:35 ` Jeff King
2021-08-23 17:44 ` Marvin Häuser
2021-08-23 18:27 ` Jeff King [this message]
2021-08-23 21:47 ` Marvin Häuser
2021-08-24 7:48 ` Carlo Marcelo Arenas Belón
2021-08-25 0:15 ` Jeff King
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=YSPomC95hxZZTHRe@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=mhaeuser@posteo.de \
/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).