Merge branch 'so/log-diff-merge'
"git log" learned a new "--diff-merges=<how>" option. * so/log-diff-merge: (32 commits) t4013: add tests for --diff-merges=first-parent doc/git-show: include --diff-merges description doc/rev-list-options: document --first-parent changes merges format doc/diff-generate-patch: mention new --diff-merges option doc/git-log: describe new --diff-merges options diff-merges: add '--diff-merges=1' as synonym for 'first-parent' diff-merges: add old mnemonic counterparts to --diff-merges diff-merges: let new options enable diff without -p diff-merges: do not imply -p for new options diff-merges: implement new values for --diff-merges diff-merges: make -m/-c/--cc explicitly mutually exclusive diff-merges: refactor opt settings into separate functions diff-merges: get rid of now empty diff_merges_init_revs() diff-merges: group diff-merge flags next to each other inside 'rev_info' diff-merges: split 'ignore_merges' field diff-merges: fix -m to properly override -c/--cc t4013: add tests for -m failing to override -c/--cc t4013: support test_expect_failure through ':failure' magic diff-merges: revise revs->diff flag handling diff-merges: handle imply -p on -c/--cc logic for log.c ...
This commit is contained in:
@ -81,9 +81,9 @@ Combined diff format
|
||||
Any diff-generating command can take the `-c` or `--cc` option to
|
||||
produce a 'combined diff' when showing a merge. This is the default
|
||||
format when showing merges with linkgit:git-diff[1] or
|
||||
linkgit:git-show[1]. Note also that you can give the `-m` option to any
|
||||
of these commands to force generation of diffs with individual parents
|
||||
of a merge.
|
||||
linkgit:git-show[1]. Note also that you can give suitable
|
||||
`--diff-merges` option to any of these commands to force generation of
|
||||
diffs in specific format.
|
||||
|
||||
A "combined diff" format looks like this:
|
||||
|
||||
|
@ -33,6 +33,57 @@ endif::git-diff[]
|
||||
show the patch by default, or to cancel the effect of `--patch`.
|
||||
endif::git-format-patch[]
|
||||
|
||||
ifdef::git-log[]
|
||||
--diff-merges=(off|none|first-parent|1|separate|m|combined|c|dense-combined|cc)::
|
||||
--no-diff-merges::
|
||||
Specify diff format to be used for merge commits. Default is
|
||||
{diff-merges-default} unless `--first-parent` is in use, in which case
|
||||
`first-parent` is the default.
|
||||
+
|
||||
--diff-merges=(off|none):::
|
||||
--no-diff-merges:::
|
||||
Disable output of diffs for merge commits. Useful to override
|
||||
implied value.
|
||||
+
|
||||
--diff-merges=first-parent:::
|
||||
--diff-merges=1:::
|
||||
This option makes merge commits show the full diff with
|
||||
respect to the first parent only.
|
||||
+
|
||||
--diff-merges=separate:::
|
||||
--diff-merges=m:::
|
||||
-m:::
|
||||
This makes merge commits show the full diff with respect to
|
||||
each of the parents. Separate log entry and diff is generated
|
||||
for each parent. `-m` doesn't produce any output without `-p`.
|
||||
+
|
||||
--diff-merges=combined:::
|
||||
--diff-merges=c:::
|
||||
-c:::
|
||||
With this option, diff output for a merge commit shows the
|
||||
differences from each of the parents to the merge result
|
||||
simultaneously instead of showing pairwise diff between a
|
||||
parent and the result one at a time. Furthermore, it lists
|
||||
only files which were modified from all parents. `-c` implies
|
||||
`-p`.
|
||||
+
|
||||
--diff-merges=dense-combined:::
|
||||
--diff-merges=cc:::
|
||||
--cc:::
|
||||
With this option the output produced by
|
||||
`--diff-merges=combined` is further compressed by omitting
|
||||
uninteresting hunks whose contents in the parents have only
|
||||
two variants and the merge result picks one of them without
|
||||
modification. `--cc` implies `-p`.
|
||||
|
||||
--combined-all-paths::
|
||||
This flag causes combined diffs (used for merge commits) to
|
||||
list the name of the file from all parents. It thus only has
|
||||
effect when `--diff-merges=[dense-]combined` is in use, and
|
||||
is likely only useful if filename changes are detected (i.e.
|
||||
when either rename or copy detection have been requested).
|
||||
endif::git-log[]
|
||||
|
||||
-U<n>::
|
||||
--unified=<n>::
|
||||
Generate diffs with <n> lines of context instead of
|
||||
|
@ -107,47 +107,15 @@ DIFF FORMATTING
|
||||
By default, `git log` does not generate any diff output. The options
|
||||
below can be used to show the changes made by each commit.
|
||||
|
||||
Note that unless one of `-c`, `--cc`, or `-m` is given, merge commits
|
||||
will never show a diff, even if a diff format like `--patch` is
|
||||
selected, nor will they match search options like `-S`. The exception is
|
||||
when `--first-parent` is in use, in which merges are treated like normal
|
||||
single-parent commits (this can be overridden by providing a
|
||||
combined-diff option or with `--no-diff-merges`).
|
||||
|
||||
-c::
|
||||
With this option, diff output for a merge commit
|
||||
shows the differences from each of the parents to the merge result
|
||||
simultaneously instead of showing pairwise diff between a parent
|
||||
and the result one at a time. Furthermore, it lists only files
|
||||
which were modified from all parents.
|
||||
|
||||
--cc::
|
||||
This flag implies the `-c` option and further compresses the
|
||||
patch output by omitting uninteresting hunks whose contents in
|
||||
the parents have only two variants and the merge result picks
|
||||
one of them without modification.
|
||||
|
||||
--combined-all-paths::
|
||||
This flag causes combined diffs (used for merge commits) to
|
||||
list the name of the file from all parents. It thus only has
|
||||
effect when -c or --cc are specified, and is likely only
|
||||
useful if filename changes are detected (i.e. when either
|
||||
rename or copy detection have been requested).
|
||||
|
||||
-m::
|
||||
This flag makes the merge commits show the full diff like
|
||||
regular commits; for each merge parent, a separate log entry
|
||||
and diff is generated. An exception is that only diff against
|
||||
the first parent is shown when `--first-parent` option is given;
|
||||
in that case, the output represents the changes the merge
|
||||
brought _into_ the then-current branch.
|
||||
|
||||
--diff-merges=off::
|
||||
--no-diff-merges::
|
||||
Disable output of diffs for merge commits (default). Useful to
|
||||
override `-m`, `-c`, or `--cc`.
|
||||
Note that unless one of `--diff-merges` variants (including short
|
||||
`-m`, `-c`, and `--cc` options) is explicitly given, merge commits
|
||||
will not show a diff, even if a diff format like `--patch` is
|
||||
selected, nor will they match search options like `-S`. The exception
|
||||
is when `--first-parent` is in use, in which case `first-parent` is
|
||||
the default format.
|
||||
|
||||
:git-log: 1
|
||||
:diff-merges-default: `off`
|
||||
include::diff-options.txt[]
|
||||
|
||||
include::diff-generate-patch.txt[]
|
||||
|
@ -45,10 +45,13 @@ include::pretty-options.txt[]
|
||||
include::pretty-formats.txt[]
|
||||
|
||||
|
||||
COMMON DIFF OPTIONS
|
||||
-------------------
|
||||
DIFF FORMATTING
|
||||
---------------
|
||||
The options below can be used to change the way `git show` generates
|
||||
diff output.
|
||||
|
||||
:git-log: 1
|
||||
:diff-merges-default: `dense-combined`
|
||||
include::diff-options.txt[]
|
||||
|
||||
include::diff-generate-patch.txt[]
|
||||
|
@ -130,6 +130,11 @@ parents) and `--max-parents=-1` (negative numbers denote no upper limit).
|
||||
this option allows you to ignore the individual commits
|
||||
brought in to your history by such a merge.
|
||||
|
||||
ifdef::git-log[]
|
||||
This option also changes default diff format for merge commits
|
||||
to `first-parent`, see `--diff-merges=first-parent` for details.
|
||||
endif::git-log[]
|
||||
|
||||
--not::
|
||||
Reverses the meaning of the '{caret}' prefix (or lack thereof)
|
||||
for all following revision specifiers, up to the next `--not`.
|
||||
|
Reference in New Issue
Block a user