git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] format-patch: add --filename-prefix to prepend a prefix to output file names

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 10, 2009, 15:58 UTC
Message-ID
<7vr5xsozcm.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1244629715-30444-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 12 quoted lines
> I use git to manage patches in my Gentoo development. In Gentoo, all
> ebuilds (another form of RPM spec) corresponding to different versions
> of the same package are grouped into one directory. So patches for
> each version usually have a prefix to separate them from ones for
> other versions. With --filename-prefix it comes handy to produce such
> patches, for example:
>
> git format-patch --filename-prefix dbus-1.2.3- HEAD~5
>
> will generate patches for dbus-1.2.3 for me, all starting with "dbus-1.2.3-".
>
> This might be handy for RPM developers as well.

If this patch needs another round, I would prefer seeing the explanation done in a different order. When a busy person who is uninterested in Gentoo starts reading the above paragraph, the patch will (incorrectly) be dismissed with an "Ah, Gentoo specific feature? Not interesting." after reading the first two lines. I.e. "Add X that does Y. This is useful in such and such situations because ...".

> +--filename-prefix=.<pfx>::
> +	Prepend specified prefix in front of generated filenames.
Hmm... ;-)

What happens when I feed a path with a slash in it with --filename-prefix? We will fail in open/creat if the leading path does not exist?

I am not saying we must allow a slash in the prefix and create necessary leading paths ourselves, nor we must check for a slash and fail in the input validation phase, but I am wondering if we can have some clever way to internally unify the handling of this new option with --outdir.

Show 9 quoted lines
> diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
> index 8b33321..cf16c0a 100755
> --- a/t/t4013-diff-various.sh
> +++ b/t/t4013-diff-various.sh
> @@ -246,6 +246,7 @@ format-patch --stdout initial..master
>  format-patch --stdout --no-numbered initial..master
>  format-patch --stdout --numbered initial..master
>  format-patch --attach --stdout initial..side
> +format-patch --attach --stdout --filename-prefix=foo- initial..side

Heh, clever. I wondered what the point of testing with --stdout was for a patch that affects the generated filename. The magic of --attach ;-)

Previous: Nguyen Thai Ngoc DuyNext: Nguyễn Thái Ngọc Duy
Message 7 of 15 in “format-patch: add --prefix to prepend a prefix to output file names”
  1. format-patch: add --prefix to prepend a prefix to output file namesNguyễn Thái Ngọc Duy, Jun 9, 2009
  2. Andreas EricssonJun 9, 2009
  3. Nguyen Thai Ngoc DuyJun 9, 2009
  4. format-patch: add --filename-prefix to prepend a prefix to output file namesNguyễn Thái Ngọc Duy, Jun 10, 2009
  5. Jakub NarebskiJun 10, 2009
  6. Nguyen Thai Ngoc DuyJun 10, 2009
  7. Junio C HamanoJun 10, 2009
  8. format-patch: add --filename-prefix to prepend a prefix to output file namesNguyễn Thái Ngọc Duy, Jun 14, 2009
  9. Junio C HamanoJun 14, 2009
  10. Stephen BoydJun 14, 2009
  11. Junio C HamanoJun 14, 2009
  12. Stephen BoydJun 14, 2009
  13. Nguyen Thai Ngoc DuyJun 14, 2009
  14. Johannes SixtJun 9, 2009
  15. Nguyen Thai Ngoc DuyJun 9, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.