Re: Is there a way to get the "format-patch" formatted file name?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vít Ondruch <vondruch@xxxxxxxxxx> 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.







[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux