To avoid broken threads when forwarding messages, add a References header field if it's missing, and point it at the bug's initial message. That should make it easier to group messages belonging to the same bug together even if people followup without setting the right headers themselves. --- scripts/process | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
This passes the test suite, and I ran it through t/06_mail_handling.t with some instrumentation and it seemed to do the right thing, so hopefully it's helpful. diff --git a/scripts/process b/scripts/process index 716e0a5..34478bb 100755 --- a/scripts/process +++ b/scripts/process @@ -181,7 +181,7 @@ for my $hdr (@headerlines) { s/\n\s/ /g; finish() if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail"; my $ins = !m/^subject:/i && !m/^reply-to:/i && !m/^return-path:/i - && !m/^From / && !m/^X-Debbugs-/i; + && !m/^From / && !m/^X-Debbugs-/i && !m/^References:/i; $fwd .= encode_utf8($hdr)."\n" if $ins; # print {$debugfh} ">$_<\n"; if (s/^(\S+):\s*//) { @@ -803,6 +803,12 @@ if (length($resentccval)) { $resentcc= "Resent-CC: $resentccval\n"; } +my $referencesval = join(' ',grep {defined $_} $header{'references'},$data->{msgid}); +my $references = ''; +if (!$newref && length($referencesval)) { + $references = "References: $referencesval\n"; +} + my $common_headers=''; { my @tmp = @common_headers; @@ -822,7 +828,7 @@ Resent-Sender: $gMaintainerEmail X-$gProject-PR-Message: report $ref X-$gProject-PR-Package: $data->{package} X-$gProject-PR-Keywords: $data->{keywords} -${source_pr_header} +${references}${source_pr_header} END chomp $enc_msg; $enc_msg = encode_utf8($enc_msg).$fwd."\n"; @@ -845,7 +851,7 @@ Resent-Sender: $gMaintainerEmail X-$gProject-PR-Message: $report_followup $ref X-$gProject-PR-Package: $data->{package} X-$gProject-PR-Keywords: $data->{keywords} -${source_pr_header} +${references}${source_pr_header} END chomp $enc_msg; $enc_msg = encode_utf8($enc_msg).$fwd."\n"; @@ -879,7 +885,7 @@ Resent-Sender: $gMaintainerEmail ${common_headers}X-$gProject-PR-Message: $report_followup $ref X-$gProject-PR-Package: $data->{package} X-$gProject-PR-Keywords: $data->{keywords} -${source_pr_header} +${references}${source_pr_header} END chomp $enc_msg; $enc_msg = encode_utf8($enc_msg).$fwd."\n"; -- 2.11.0