Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

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

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:46:57

Possibly related (same subject, not in this thread)

2009/6/14 Stephen Boyd [off-list ref]:
Nguyễn Thái Ngọc Duy wrote:
quoted
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.
Well, for true flexibility, I would implement something like printf
format. But that would be overkill.
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.
They are read by human, i.e. ebuild developers, and uptream developers
too when they are submitted upstream (which is great because if
upstream uses Git, you don't have to do anything else). Plain patches
are enough for portage, other information is for human ;-)
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help