Subject: Re: [PATCH] mailsplit add option to include sanitized subject in filename

From: Junio C Hamano <[email-masked]>
Date: Thu, 11 Apr 2024 14:25:52 -0700

Jacob Keller <[email-masked]> writes:

>> THe next level would be to still assume that you stop at the same
>> place (i.e. you do not support patches from multiple series in the
>> same mailbox), but use the number-santized-subject format.  This
>> would be a bit more involved, but I think all you need to update on
>> the "am" side is where the am_run() assigns the message file to the
>> local variable "mail".  You know the temporary directory where you
>> told "mailsplit" to create these individual messages, so you should
>> be able to "opendir/readdir/closedir" and create a list of numbered
>> files in the directory very early in "git am".  Knowing msgnum(state)
>> at that point in the loop, it should be trivial to change the code
>> that currently assumes the 4-th file is named "0004" to check for
>> the file whose name begins with "0004-".
>
> Yea, we pretty much just have to get the git-am process to work with the
> new names. I can look at using opendir/readdir here instead.

Not "here", but probably just after you called "mailsplit" and saw
it return.  After that nobody should be adding more split mail
messages to the directory, so you do it once to grab all filenames.

> Ya I don't care much about multiple series. I care more about making it
> handle scrambled series better than it does now. I download series off
> of lore.kernel.org (public-inbox based) and those seem to routinely have
> series out-of-order. I suspect this is because it bases them on arrival
> date and sometimes certain mailers get it out of order when sending.

Yeah, and that is why I said it would be a better use of the
engineering resource to fix it at the source.  Such a fix will
benefit folks with existing versions of "git am", not needing to
wait for your improved version.

Thanks.