Skip to content

Commit 04b508f

Browse files
committed
Merge branch 'jc/logsemantics'
* jc/logsemantics: "format-patch --root rev" is the way to show everything. Porcelain level "log" family should recurse when diffing.
2 parents 0c783f6 + 8a1d076 commit 04b508f

File tree

4 files changed

+35
-14
lines changed

4 files changed

+35
-14
lines changed

Documentation/git-format-patch.txt

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,32 @@ SYNOPSIS
1616
[--in-reply-to=Message-Id] [--suffix=.<sfx>]
1717
[--ignore-if-in-upstream]
1818
[--subject-prefix=Subject-Prefix]
19-
<since>[..<until>]
19+
[ <since> | <revision range> ]
2020

2121
DESCRIPTION
2222
-----------
2323

24-
Prepare each commit between <since> and <until> with its patch in
24+
Prepare each commit with its patch in
2525
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-
3126
The output of this command is convenient for e-mail submission or
3227
for use with gitlink:git-am[1].
3328

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+
3445
By default, each output file is numbered sequentially from 1, and uses the
3546
first line of the commit message (massaged for pathname safety) as
3647
the filename. With the --numbered-files option, the output file names
@@ -153,6 +164,10 @@ git-format-patch origin::
153164
not in the origin branch. For each commit a separate file
154165
is created in the current directory.
155166

167+
git-format-patch \--root origin::
168+
Extract all commits which that leads to 'origin' since the
169+
inception of the project.
170+
156171
git-format-patch -M -B origin::
157172
The same as the previous one. Additionally, it detects
158173
and handles renames and complete rewrites intelligently to

Documentation/git-log.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ git log --since="2 weeks ago" \-- gitk::
9696
The "--" is necessary to avoid confusion with the *branch* named
9797
'gitk'
9898

99-
git log -r --name-status release..test::
99+
git log --name-status release..test::
100100

101101
Show the commits that are in the "test" branch but not yet
102102
in the "release" branch, along with the list of paths

Documentation/user-manual.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ file such that it contained the given content either before or after the
921921
commit. You can find out with this:
922922

923923
-------------------------------------------------
924-
$ git log --raw -r --abbrev=40 --pretty=oneline -- filename |
924+
$ git log --raw --abbrev=40 --pretty=oneline -- filename |
925925
grep -B 1 `git hash-object filename`
926926
-------------------------------------------------
927927

builtin-log.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
5555
rev->abbrev = DEFAULT_ABBREV;
5656
rev->commit_format = CMIT_FMT_DEFAULT;
5757
rev->verbose_header = 1;
58+
rev->diffopt.recursive = 1;
5859
rev->show_root_diff = default_show_root;
5960
rev->subject_prefix = fmt_patch_subject_prefix;
6061
argc = setup_revisions(argc, argv, rev, "HEAD");
@@ -116,7 +117,6 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
116117
git_config(git_log_config);
117118
init_revisions(&rev, prefix);
118119
rev.diff = 1;
119-
rev.diffopt.recursive = 1;
120120
rev.simplify_history = 0;
121121
cmd_log_init(argc, argv, prefix, &rev);
122122
if (!rev.diffopt.output_format)
@@ -165,7 +165,6 @@ int cmd_show(int argc, const char **argv, const char *prefix)
165165
git_config(git_log_config);
166166
init_revisions(&rev, prefix);
167167
rev.diff = 1;
168-
rev.diffopt.recursive = 1;
169168
rev.combine_merges = 1;
170169
rev.dense_combined_merges = 1;
171170
rev.always_show_header = 1;
@@ -586,12 +585,19 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
586585
}
587586

588587
if (rev.pending.nr == 1) {
589-
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+
*/
590594
rev.pending.objects[0].item->flags |= UNINTERESTING;
591595
add_head(&rev);
592596
}
593-
/* Otherwise, it is "format-patch -22 HEAD", and
594-
* 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.
595601
*/
596602
}
597603

0 commit comments

Comments
 (0)