]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'mh/send-email-reset-in-reply-to'
authorJunio C Hamano <gitster@pobox.com>
Fri, 10 Sep 2021 18:46:25 +0000 (11:46 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Sep 2021 18:46:25 +0000 (11:46 -0700)
Even when running "git send-email" without its own threaded
discussion support, a threading related header in one message is
carried over to the subsequent message to result in an unwanted
threading, which has been corrected.

* mh/send-email-reset-in-reply-to:
  send-email: avoid incorrect header propagation

1  2 
git-send-email.perl
t/t9001-send-email.sh

Simple merge
index 595cbad37204c59be681945dbe0f3df3f63974f2,35be6b019037a8c89288ebdb738d58c062eab1aa..9022074474f66d47593ececb44cad52a7b8a4193
@@@ -2196,37 -2097,51 +2196,82 @@@ test_expect_success $PREREQ 'leading an
        test_cmp expected-list actual-list
  '
  
 +test_expect_success $PREREQ 'test using command name with --sendmail-cmd' '
 +      clean_fake_sendmail &&
 +      PATH="$PWD:$PATH" \
 +      git send-email \
 +              --from="Example <nobody@example.com>" \
 +              --to=nobody@example.com \
 +              --sendmail-cmd="fake.sendmail" \
 +              HEAD^ &&
 +      test_path_is_file commandline1
 +'
 +
 +test_expect_success $PREREQ 'test using arguments with --sendmail-cmd' '
 +      clean_fake_sendmail &&
 +      git send-email \
 +              --from="Example <nobody@example.com>" \
 +              --to=nobody@example.com \
 +              --sendmail-cmd='\''"$(pwd)/fake.sendmail" -f nobody@example.com'\'' \
 +              HEAD^ &&
 +      test_path_is_file commandline1
 +'
 +
 +test_expect_success $PREREQ 'test shell expression with --sendmail-cmd' '
 +      clean_fake_sendmail &&
 +      git send-email \
 +              --from="Example <nobody@example.com>" \
 +              --to=nobody@example.com \
 +              --sendmail-cmd='\''f() { "$(pwd)/fake.sendmail" "$@"; };f'\'' \
 +              HEAD^ &&
 +      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 correct 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 &&
+       grep "In-Reply-To: <cmdline.reply@example.com>" msgtxt1 &&
+       grep "References: <cmdline.reply@example.com>" msgtxt1 &&
+       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 &&