Skip to contentSkip to conversation

Add the --numbered-files option to git-format-patch.

PATCH In review Jon Loeliger 2 participants 2 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add the --numbered-files option to git-format-patch.

With this option, git-format-patch will generate simple numbered files as output instead of the default using with the first commit line appended.

This simplifies the ability to generate an MH-style drafts folder with each message to be sent.

---

Most of this patch is indenting the "if (sol)" clause by one level. Maybe apply it and "diff -w" to see if you believe the patch.

Amazingly, some old guys in the crowd still use MH.

Yep, I used the new option to set up sending this message!

And, yes, I debated a more generalized option like:

    --filenames=<fmt>

with <fmt> being generalized for interpolatable things, but I don't know what other things would have been interesting. So I opted for KISS.

jdl

 Documentation/git-format-patch.txt |   14 ++++-
 builtin-log.c                      |   97 +++++++++++++++++++++---------------
 2 files changed, 67 insertions(+), 44 deletions(-)
Documentation/git-format-patch.txt +11 -3
index a33d157..363edb0 100644
@@ -11,7 +11,8 @@ SYNOPSIS
 [verse]
 'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--thread]
                    [--attach[=<boundary>] | --inline[=<boundary>]]
-                   [-s | --signoff] [<common diff options>] [--start-number <n>]
+                   [-s | --signoff] [<common diff options>]
+                   [--start-number <n>] [--numbered-files]
                    [--in-reply-to=Message-Id] [--suffix=.<sfx>]
                    [--ignore-if-in-upstream]
                    [--subject-prefix=Subject-Prefix]
@@ -30,9 +31,11 @@ gitlink:git-rev-parse[1].
 The output of this command is convenient for e-mail submission or
 for use with gitlink:git-am[1].
 
-Each output file is numbered sequentially from 1, and uses the
+By default, each output file is numbered sequentially from 1, and uses the
 first line of the commit message (massaged for pathname safety) as
-the filename. The names of the output files are printed to standard
+the filename. With the --numbered-files option, the output file names
+will only be numbers, without the first line of the commit appended.
+The names of the output files are printed to standard
 output, unless the --stdout option is specified.
 
 If -o is specified, output files are created in <dir>.  Otherwise
@@ -60,6 +63,11 @@ include::diff-options.txt[]
 --start-number <n>::
 	Start numbering the patches at <n> instead of 1.
 
+--numbered-files::
+	Output file names will be a simple number sequence
+	without the default first line of the commit appended.
+	Mutually exclusive with the --stdout option.
+
 -k|--keep-subject::
 	Do not strip/add '[PATCH]' from the first line of the
 	commit log message.
builtin-log.c +56 -41

141 lines not on this page · raw message

Signature · 1 line
1.5.2.1.116.g9f308-dirty
#1 lore raw
Quoted 6 lines · Jon Loeliger

With this option, git-format-patch will generate simple numbered files as output instead of the default using with the first commit line appended.

This simplifies the ability to generate an MH-style drafts folder with each message to be sent.

I'll take the patch but wouldn't something like:

	git-format-patch --stdout $args |
        FILENO=7 formail -s sh -c 'cat >.junk/$FILENO'

be equivalent to

	git-format-patch -o .junk/ --numbered-files --start-number=7 $args

and more flexible?