Subject: bug#60147: 30.0.50; vc-prepare-patch: Add numbered patch file names

From: Philip Kaludercic <[email-masked]>
Date: Sun, 18 Dec 2022 10:45:17 +0000

Sean Whitton <[email-masked]> writes:

> Hello,
>
> On Sat 17 Dec 2022 at 09:33AM GMT, Philip Kaludercic wrote:
>
>>> +                     (filename
>>> +                      (concat
>>> +                       (string-trim
>>> +                        (replace-regexp-in-string
>>> +                         "\\W" "-" (if (length> stripped-subject 50)
>>> +                                       (substring stripped-subject 0 50)
>>> +                                     stripped-subject))
>>
>> Is limiting the file names to ~50 characters a Git thing?
>
> Git does it, yes, and I thought it seemed like a good idea in general.

OK, then it should be a good convention.  And if the file names are
numbered, then there shouldn't be any conflicts when downloading
patches.

>>> +                (mml-attach-buffer
>>> +                 (buffer-name (plist-get patch :buffer))
>>> +                 "text/x-patch"
>>> +                 patch-subject
>>> +                 "attachment"
>>> +                 (format "%04d-%s" (cl-incf i) filename))))))
>>
>> Is the new additional argument really necessary, or couldn't we just
>> rename the generated buffer?  We could specify that the buffer must be
>> fresh/renameable.
>
> The description and the filename for an attachment are not the same
> thing -- I don't believe MUAs will save the files with the correct name
> unless there is the filename= field.  And I think it's a useful general
> addition to mml-attach-buffer.

I see, in that case this should be fine.  Can you apply the patch?