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
Stephen Boyd <bebarino@gmail.com>
Date
Jun 14, 2009, 08:29 UTC
Message-ID
<4A34B4ED.6060301@gmail.com>
In-Reply-To
<1244963400-1739-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy wrote:
Show 22 quoted lines
> diff --git a/log-tree.c b/log-tree.c
> index 59d63eb..139c8b5 100644
> --- a/log-tree.c
> +++ b/log-tree.c
> @@ -180,12 +180,13 @@ static int has_non_ascii(const char *s)
>  	return 0;
>  }
>  
> -void get_patch_filename(struct commit *commit, int nr, const char *suffix,
> -			struct strbuf *buf)
> +void get_patch_filename(struct commit *commit, int nr, const char *prefix,
> +			const char *suffix, struct strbuf *buf)
>  {
>  	int suffix_len = strlen(suffix) + 1;
> -	int start_len = buf->len;
> +	int start_len = buf->len + strlen(prefix);
>  
> +	strbuf_addstr(buf, prefix);
>  	strbuf_addf(buf, commit ? "%04d-" : "%d", nr);
>  	if (commit) {
>  		int max_len = start_len + FORMAT_PATCH_NAME_MAX - suffix_len;
>   

Why does the prefix length not count against the filename length? I think you want to subtract a prefix_len.

Also, this doesn't replace the numbering (0001, 0002, etc.) which I consider to be a prefix. Does anyone else feel the same way?

This is kind of a funny thought, but I'll throw it out there. Could you just put the desired prefix in your patch subjects, and then add an option for no-numbered-files? So in your case, you add "dbus 1.2.3" at the start of each subject during git-commit and then format-patch with --no-numbered-files. This way you get git to insert the dashes you want, other people get files with no numbers, and you don't have to deal with slashes and directory prefixes.

I'm kind of confused about this though. The patches you're generating for Gentoo are not being read by humans; merely being applied by portage correct? Are you going back and removing the mail headers and commit messages from these patches? What I'm getting at is for your case format-patch may be overkill.

Previous: Junio C HamanoNext: Junio C Hamano
Message 10 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.