"format-patch --root rev" is the way to show everything.
We used to trigger the special case "things not in origin" semantics only when one and only one positive ref is given, and no number (e.g. "git format-patch -4 origin") was specified, and used the general revision range semantics for everything else. This narrows the special case a bit more, by making: git format-patch --root this_version to show everything that leads to the named commit. More importantly, document the two different semantics better. The generic revision range semantics came later and bolted on without being clearly documented. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Aug 28, 2007 at 00:38 UTC
8a1d076e21810f5bc7e9ef10d84f7ca9637b89af
2 files changed
+32
-10
Documentation/git-format-patch.txt
+22
-7
@@ -16,21 +16,32 @@ SYNOPSIS
16
[--in-reply-to=Message-Id] [--suffix=.<sfx>]
17
[--ignore-if-in-upstream]
18
[--subject-prefix=Subject-Prefix]
19
- <since>[..<until>]
19
+ [ <since> | <revision range> ]
20
21
DESCRIPTION
22
-----------
23
24
-Prepare each commit between <since> and <until> with its patch in
24
+Prepare each commit with its patch in
25
one file per commit, formatted to resemble UNIX mailbox format.
26
-If ..<until> is not specified, the head of the current working
27
-tree is implied. For a more complete list of ways to spell
28
-<since> and <until>, see "SPECIFYING REVISIONS" section in
29
-gitlink:git-rev-parse[1].
30
-
26
The output of this command is convenient for e-mail submission or
27
for use with gitlink:git-am[1].
28
29
+There are two ways to specify which commits to operate on.
30
+
31
+1. A single commit, <since>, specifies that the commits leading
32
+ to the tip of the current branch that are not in the history
33
+ that leads to the <since> to be output.
34
+
35
+2. Generic <revision range> expression (see "SPECIFYING
36
+ REVISIONS" section in gitlink:git-rev-parse[1]) means the
37
+ commits in the specified range. A single commit, when
38
+ interpreted as a <revision range> expression, means
39
+ "everything that leads to that commit", but that is taken as
40
+ the special case above. If you want to format everything
41
+ since project inception to one commit, say "git format-patch
42
+ \--root <that-commit>", as showing the root commit as patch
43
+ requires \--root option anyway.
44
+
45
By default, each output file is numbered sequentially from 1, and uses the
46
first line of the commit message (massaged for pathname safety) as
47
the filename. With the --numbered-files option, the output file names
@@ -153,6 +164,10 @@ git-format-patch origin::
164
not in the origin branch. For each commit a separate file
165
is created in the current directory.
166
167
+git-format-patch \--root origin::
168
+ Extract all commits which that leads to 'origin' since the
169
+ inception of the project.
170
+
171
git-format-patch -M -B origin::
172
The same as the previous one. Additionally, it detects
173
and handles renames and complete rewrites intelligently to
builtin-log.c
+10
-3
@@ -585,12 +585,19 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
585
}
586
587
if (rev.pending.nr == 1) {
588
- if (rev.max_count < 0) {
588
+ if (rev.max_count < 0 && !rev.show_root_diff) {
589
+ /*
590
+ * This is traditional behaviour of "git format-patch
591
+ * origin" that prepares what the origin side still
592
+ * does not have.
593
+ */
594
rev.pending.objects[0].item->flags |= UNINTERESTING;
595
add_head(&rev);
596
}
592
- /* Otherwise, it is "format-patch -22 HEAD", and
593
- * get_revision() would return only the specified count.
597
+ /*
598
+ * Otherwise, it is "format-patch -22 HEAD", and/or
599
+ * "format-patch --root HEAD". The user wants
600
+ * get_revision() to do the usual traversal.
601
*/
602
}
603