Often, a patch series will be sent with a cover letter which describes the
series and is given the '0/n' patch number. Rather than dropping these
patches, keep track of them in series. We do this by checking whether the 1/n
patch has an "In-Reply-To" header. This usually means that their will be an
associated cover letter. Once this is found, rather than sending the patch
directly on to the test program, we use the cover letter's subject by using
formail to add a special "Series-Subject". This makes it so that the
aiaiai-email will end up as a reply to the cover letter which is a bit more
aesthetically pleasing to users.
To help this process, a new "series_is_complete" function is added in place of
the original series complete check. This function reports whether the series
is completely queued, for both cases of cover letter and no cover letter.
Artem:
I've modified this patch.
1. Removed a couple of '[[' bash constructs
2. Also preserved the Message ID of the cover letter to make the reply not only
have the subject of the cover letter, but also refer the cover letter
properly.
3. Use common prefix for the special cover letter e-mail headers that we add:
X-Aiaiai-Cover-Letter-Subject
X-Aiaiai-Cover-Letter-Message-Id
4. Dropped sponge dependency. Generally, this is a nice tool, and I did not
hear about it before. I'll definitely start using it when constructing pipes
in the console. But this tool is not that well-known, so it is not typically
present in systems. E.g., mine do not have it. And I decided to avoid adding
another dependency, we already require a lot of tools. Instead, I used
another trick, which is actual just as elegant as using sponge. Well, needs
more lines of code, but it is really nice trick anyway, I like it.
I just open the mbox file, then unlink it, which means it won't be visible
in the file-system, but won't be deleted since we have the file descriptor
opened. Then I pipe the data from the file descriptor to 'formail', and
redirect the results to the mbox file. So a new mbox file will be created
and all the new contents will be there. I think this is elegant, and does
not add a new dependency.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>