summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-09-10 18:46:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-10 18:46:25 (GMT)
commitbd29bcf9136c6cb96dba3bb79c532b3b215fb9d8 (patch)
tree8946be40a1592063893e9ea2afda9a5da39c591e /git-send-email.perl
parent0538a2586e7c4d9fd5ec6ecdc4cf04101ee73a6b (diff)
parente0821134846b10952efc0737b9e32ca8226f0a4d (diff)
downloadgit-bd29bcf9136c6cb96dba3bb79c532b3b215fb9d8.zip
git-bd29bcf9136c6cb96dba3bb79c532b3b215fb9d8.tar.gz
git-bd29bcf9136c6cb96dba3bb79c532b3b215fb9d8.tar.bz2
Merge branch 'mh/send-email-reset-in-reply-to'
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
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl26
1 files changed, 17 insertions, 9 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index e65d969..fd79849 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1697,7 +1697,6 @@ EOF
$in_reply_to = $initial_in_reply_to;
$references = $initial_in_reply_to || '';
-$subject = $initial_subject;
$message_num = 0;
# Prepares the email, prompts the user, sends it out
@@ -1720,6 +1719,7 @@ sub process_file {
@xh = ();
my $input_format = undef;
my @header = ();
+ $subject = $initial_subject;
$message = "";
$message_num++;
# First unfold multiline header fields
@@ -1926,15 +1926,23 @@ sub process_file {
}
# set up for the next message
- if ($thread && $message_was_sent &&
- ($chain_reply_to || !defined $in_reply_to || length($in_reply_to) == 0 ||
- $message_num == 1)) {
- $in_reply_to = $message_id;
- if (length $references > 0) {
- $references .= "\n $message_id";
- } else {
- $references = "$message_id";
+ if ($thread) {
+ if ($message_was_sent &&
+ ($chain_reply_to || !defined $in_reply_to || length($in_reply_to) == 0 ||
+ $message_num == 1)) {
+ $in_reply_to = $message_id;
+ if (length $references > 0) {
+ $references .= "\n $message_id";
+ } else {
+ $references = "$message_id";
+ }
}
+ } elsif (!defined $initial_in_reply_to) {
+ # --thread and --in-reply-to manage the "In-Reply-To" header and by
+ # extension the "References" header. If these commands are not used, reset
+ # the header values to their defaults.
+ $in_reply_to = undef;
+ $references = '';
}
$message_id = undef;
$num_sent++;