From: Vít Ondruch Date: Thu, 31 Aug 2023 09:49:10 GMT Subject: Is there a way to get the "format-patch" formatted file name? Message-ID: Hi, My typical use case is to download patches from GH, e.g.: ~~~ $ curl -OL https://github.com/rails/sprockets/pull/791.patch   % Total    % Received % Xferd  Average Speed   Time    Time Time  Current                                  Dload  Upload   Total   Spent Left  Speed   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0 100 12717    0 12717    0     0  21765      0 --:--:-- --:--:-- --:--:-- 58603 ~~~ The problem with this is that I end up with the "791.patch" file, while I'd like have a file with similar name as if I have used the git command: ~~~ $ git format-patch -1 6554b6d 0001-Fix-Minitest-constant-name-in-tests.patch ~~~ So I wonder, is there a way to get such file name? The basic use case which would be enough for me would be to obtain the string: ~~~ $ head -4 791.patch | tail -1 Subject: [PATCH] Fix Minitest constant name in tests ~~~ and then use something like: ~~~ $ echo "Fix Minitest constant name in tests" | git sanitize-string-into-filename Fix-Minitest-constant-name-in-tests ~~~ Of course I can imagine something more fancy such as: ~~~ $ git extract-filenames-from-patch 791.patch 0001-Fix-Minitest-constant-name-in-tests.patch ~~~ IOW, I'd like if the `fmt_output_subject` method (if that is the right one): https://github.com/git/git/blob/6e8611e90a629e38da1e7c0e1f986bc6ec23a330/log-tree.c#L388 was more user exposed. Of course I could put some script like this together myself, but I think that Git already has all the pluming. Thank you in advance Vít P.S.: Please keep me in the CC, because I am not subscribed to this ML