git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <bebarino@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jakub Narebski <jnareb@gmail.com>, Andreas Ericsson <ae@op5.se>
Subject: Re: [PATCH] format-patch: add --filename-prefix to prepend a prefix to output file names
Date: Sun, 14 Jun 2009 01:29:33 -0700	[thread overview]
Message-ID: <4A34B4ED.6060301@gmail.com> (raw)
In-Reply-To: <1244963400-1739-1-git-send-email-pclouds@gmail.com>

Nguyễn Thái Ngọc Duy wrote:
> 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.

  parent reply	other threads:[~2009-06-14  8:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 11:33 [PATCH] format-patch: add --prefix to prepend a prefix to output file names Nguyễn Thái Ngọc Duy
2009-06-09 12:37 ` Andreas Ericsson
2009-06-09 23:14   ` Nguyen Thai Ngoc Duy
2009-06-10 10:28   ` [PATCH] format-patch: add --filename-prefix " Nguyễn Thái Ngọc Duy
2009-06-10 10:51     ` Jakub Narebski
2009-06-10 10:56       ` Nguyen Thai Ngoc Duy
2009-06-10 15:58     ` Junio C Hamano
2009-06-14  7:10       ` Nguyễn Thái Ngọc Duy
2009-06-14  8:25         ` Junio C Hamano
2009-06-14  8:29         ` Stephen Boyd [this message]
2009-06-14  8:59           ` Junio C Hamano
2009-06-14 19:46             ` Stephen Boyd
2009-06-14 23:32           ` Nguyen Thai Ngoc Duy
2009-06-09 13:30 ` [PATCH] format-patch: add --prefix " Johannes Sixt
2009-06-09 23:18   ` Nguyen Thai Ngoc Duy

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=4A34B4ED.6060301@gmail.com \
    --to=bebarino@gmail.com \
    --cc=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    --cc=pclouds@gmail.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 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).