mirror of
https://github.com/git/git
synced 2024-06-30 22:54:27 +00:00
diff-merges: introduce '--dd' option
This option provides a shortcut to request diff with respect to first parent for any kind of commit, universally. It's implemented as pure synonym for "--diff-merges=first-parent --patch". Gives user quick and universal way to see what changes, exactly, were brought to a branch by merges as well as by regular commits. Signed-off-by: Sergey Organov <sorganov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
be3820c60c
commit
c8e5cb0658
|
@ -50,6 +50,11 @@ ifdef::git-log[]
|
||||||
Produce dense combined diff output for merge commits.
|
Produce dense combined diff output for merge commits.
|
||||||
Shortcut for '--diff-merges=dense-combined -p'.
|
Shortcut for '--diff-merges=dense-combined -p'.
|
||||||
|
|
||||||
|
--dd::
|
||||||
|
Produce diff with respect to first parent for both merge and
|
||||||
|
regular commits.
|
||||||
|
Shortcut for '--diff-merges=first-parent -p'.
|
||||||
|
|
||||||
--remerge-diff::
|
--remerge-diff::
|
||||||
Produce remerge-diff output for merge commits.
|
Produce remerge-diff output for merge commits.
|
||||||
Shortcut for '--diff-merges=remerge -p'.
|
Shortcut for '--diff-merges=remerge -p'.
|
||||||
|
|
|
@ -120,7 +120,7 @@ By default, `git log` does not generate any diff output. The options
|
||||||
below can be used to show the changes made by each commit.
|
below can be used to show the changes made by each commit.
|
||||||
|
|
||||||
Note that unless one of `--diff-merges` variants (including short
|
Note that unless one of `--diff-merges` variants (including short
|
||||||
`-m`, `-c`, and `--cc` options) is explicitly given, merge commits
|
`-m`, `-c`, `--cc`, and `--dd` options) is explicitly given, merge commits
|
||||||
will not show a diff, even if a diff format like `--patch` is
|
will not show a diff, even if a diff format like `--patch` is
|
||||||
selected, nor will they match search options like `-S`. The exception
|
selected, nor will they match search options like `-S`. The exception
|
||||||
is when `--first-parent` is in use, in which case `first-parent` is
|
is when `--first-parent` is in use, in which case `first-parent` is
|
||||||
|
|
|
@ -131,6 +131,9 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
|
||||||
} else if (!strcmp(arg, "--cc")) {
|
} else if (!strcmp(arg, "--cc")) {
|
||||||
set_dense_combined(revs);
|
set_dense_combined(revs);
|
||||||
revs->merges_imply_patch = 1;
|
revs->merges_imply_patch = 1;
|
||||||
|
} else if (!strcmp(arg, "--dd")) {
|
||||||
|
set_first_parent(revs);
|
||||||
|
revs->merges_imply_patch = 1;
|
||||||
} else if (!strcmp(arg, "--remerge-diff")) {
|
} else if (!strcmp(arg, "--remerge-diff")) {
|
||||||
set_remerge_diff(revs);
|
set_remerge_diff(revs);
|
||||||
revs->merges_imply_patch = 1;
|
revs->merges_imply_patch = 1;
|
||||||
|
|
|
@ -473,6 +473,14 @@ test_expect_success 'log --diff-merges=on matches --diff-merges=separate' '
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'log --dd matches --diff-merges=1 -p' '
|
||||||
|
git log --diff-merges=1 -p master >result &&
|
||||||
|
process_diffs result >expected &&
|
||||||
|
git log --dd master >result &&
|
||||||
|
process_diffs result >actual &&
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'deny wrong log.diffMerges config' '
|
test_expect_success 'deny wrong log.diffMerges config' '
|
||||||
test_config log.diffMerges wrong-value &&
|
test_config log.diffMerges wrong-value &&
|
||||||
test_expect_code 128 git log
|
test_expect_code 128 git log
|
||||||
|
|
Loading…
Reference in New Issue
Block a user