All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Vít Ondruch" <vondruch@redhat.com>
Cc: git@vger.kernel.org
Subject: Re: Is there a way to get the "format-patch" formatted file name?
Date: Thu, 31 Aug 2023 10:19:21 -0700	[thread overview]
Message-ID: <xmqqo7inw2na.fsf@gitster.g> (raw)
In-Reply-To: <aa35fbdb-cca4-ae04-4124-9498d682ec06@redhat.com> ("Vít Ondruch"'s message of "Thu, 31 Aug 2023 11:49:10 +0200")

Vít Ondruch <vondruch@redhat.com> writes:

> My typical use case is to download patches from GH, e.g.:
>
> ~~~
>
> $ curl -OL https://github.com/rails/sprockets/pull/791.patch
...
> 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?

Do you mean: GitHub should let me run this command instead

  $ curl -OL https://github.com/rails/sprockets/pull/0001-Fix-Minitest-constant-name-in-tests.patch

It may be nice for them to give a more meaningful name to their pull
request (not just the output file name) than just an integer.  But
that is not a question/request we can answer here (this is not a
help forum for GitHub users).

Something along the lines of

    sed -ne '/^Subject: /{
            s/^Subject: *\[PATCH[^]]*\] *//;
            s/[^a-zA-Z0-9]/-/g;
            s/--*/-/g;
            s/$/\.patch/;
	    p;
	    q;
    }' 791.patch

should be doable, but I am not sure what the benefit is.  Once you
get it in Git, you'd park it on a branch with a useful name and we
can forget about "791", so the "The files we get from GitHub are
named in a way that makes it hard to identify them" does not sound
like a Git issue, at least to me.




  parent reply	other threads:[~2023-08-31 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqo7inw2na.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=vondruch@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.