diff options
| author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2024-12-16 14:11:21 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-16 08:45:48 -0800 |
| commit | f8043236c6c9cb9e943a87ab2e55e8e394796727 (patch) | |
| tree | 467a7cd8324222ae4db001d4d6acadd5a9e5ab58 /t/t3206-range-diff.sh | |
| parent | eb8374c652e56ee18702a8d0b06dd6bf6d07eff7 (diff) | |
| download | git-f8043236c6c9cb9e943a87ab2e55e8e394796727.tar.gz | |
range-diff: optionally include merge commits' diffs in the analysis
The `git log` command already offers support for including diffs for
merges, via the `--diff-merges=<format>` option.
Let's add corresponding support for `git range-diff`, too. This makes it
more convenient to spot differences between commit ranges that contain
merges.
This is especially true in scenarios with non-trivial merges, i.e.
merges introducing changes other than, or in addition to, what merge ORT
would have produced. Merging a topic branch that changes a function
signature into a branch that added a caller of that function, for
example, would require the merge commit itself to adjust that caller to
the modified signature.
In my code reviews, I found the `--diff-merges=remerge` option
particularly useful.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3206-range-diff.sh')
| -rwxr-xr-x | t/t3206-range-diff.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index 86010931ab..c18a3fdab8 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -909,4 +909,20 @@ test_expect_success 'submodule changes are shown irrespective of diff.submodule' test_cmp expect actual ' +test_expect_success '--diff-merges' ' + renamed_oid=$(git rev-parse --short renamed-file) && + tree=$(git merge-tree unmodified renamed-file) && + clean=$(git commit-tree -m merge -p unmodified -p renamed-file $tree) && + clean_oid=$(git rev-parse --short $clean) && + conflict=$(git commit-tree -m merge -p unmodified -p renamed-file^ $tree) && + conflict_oid=$(git rev-parse --short $conflict) && + + git range-diff --diff-merges=1 $clean...$conflict >actual && + cat >expect <<-EOF && + 1: $renamed_oid < -: ------- s/12/B/ + 2: $clean_oid = 1: $conflict_oid merge + EOF + test_cmp expect actual +' + test_done |
