git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is there a way to get the "format-patch" formatted file name?
@ 2023-08-31  9:49 Vít Ondruch
  2023-08-31 11:04 ` Oswald Buddenhagen
  2023-08-31 17:19 ` Junio C Hamano
  0 siblings, 2 replies; 10+ messages in thread
From: Vít Ondruch @ 2023-08-31  9:49 UTC (permalink / raw)
  To: git


[-- Attachment #1.1: Type: text/plain, Size: 1831 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-09-01 16:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-31  9:49 Is there a way to get the "format-patch" formatted file name? Vít Ondruch
2023-08-31 11:04 ` Oswald Buddenhagen
2023-08-31 12:13   ` Vít Ondruch
2023-08-31 12:46     ` Oswald Buddenhagen
2023-08-31 17:19 ` Junio C Hamano
2023-09-01  8:56   ` Vít Ondruch
2023-09-01 11:00     ` Oswald Buddenhagen
2023-09-01 15:53       ` Junio C Hamano
2023-09-01 16:04         ` Junio C Hamano
2023-09-01 16:37         ` Vít Ondruch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).