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

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

 



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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]