Skip to content

Commit e53466b

Browse files
committed
Merge branch 'ag/send-email-edit-threading-fix' into next
"git send-email" incremented its internal message counter when a message was edited, which made logic that treats the first message specially misbehave, which has been corrected. * ag/send-email-edit-threading-fix: send-email: show the new message id assigned by outlook in the logs send-email: fix bug resulting in broken threads if a message is edited
2 parents c58618e + 2cc27b3 commit e53466b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

git-send-email.perl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,8 +1653,18 @@ sub send_message {
16531653
default => $ask_default);
16541654
die __("Send this email reply required") unless defined $_;
16551655
if (/^n/i) {
1656+
# If we are skipping a message, we should make sure that
1657+
# the next message is treated as the successor to the
1658+
# previously sent message, and not the skipped message.
1659+
$message_num--;
16561660
return 0;
16571661
} elsif (/^e/i) {
1662+
# Since the same message will be sent again, we need to
1663+
# decrement the message number to the previous message.
1664+
# Otherwise, the edited message will be treated as a
1665+
# different message sent after the original non-edited
1666+
# message.
1667+
$message_num--;
16581668
return -1;
16591669
} elsif (/^q/i) {
16601670
cleanup_compose_files();
@@ -1778,7 +1788,8 @@ sub send_message {
17781788
if (is_outlook($smtp_server)) {
17791789
if ($smtp->message =~ /<([^>]+)>/) {
17801790
$message_id = "<$1>";
1781-
printf __("Outlook reassigned Message-ID to: %s\n"), $message_id;
1791+
$header =~ s/^(Message-ID:\s*).*\n/${1}$message_id\n/m;
1792+
printf __("Outlook reassigned Message-ID to: %s\n"), $message_id if $smtp->debug;
17821793
} else {
17831794
warn __("Warning: Could not retrieve Message-ID from server response.\n");
17841795
}

0 commit comments

Comments
 (0)