From: kristofferhaugsbakk@fastmail.com
To: git@vger.kernel.org
Cc: Kristoffer Haugsbakk <code@khaugsbakk.name>
Subject: [PATCH 06/12] t4205: test --diff-merges
Date: Wed, 2 Dec 2026 23:14:14 +0100 [thread overview]
Message-ID: <test_--diff-merges.df5@m5gid.xyz> (raw)
In-Reply-To: <CV_diff-tree_NUL_termination.def@m5gid.xyz>
From: Kristoffer Haugsbakk <code@khaugsbakk.name>
There are no test cases for diff output on merge commits. Let’s add a
few. In particular, we need the 'log --diff-merges NUL terminated' to
test this code path according to the previous commit.
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
---
t/t4205-log-pretty-formats.sh | 57 +++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index a9a470606cf..ece4def4cfd 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -215,6 +215,63 @@ test_expect_success 'NUL termination with --reflog --pretty=oneline' '
test_cmp expect actual
'
+test_expect_success 'setup merge' '
+ original=$(git branch --show-current) &&
+ git checkout -b merge-branch &&
+ git checkout -b f &&
+ echo on-a-branch >feature.txt &&
+ git add feature.txt &&
+ test_commit --no-tag on-another-branch feature.txt &&
+ git checkout merge-branch &&
+ git merge --no-ff f &&
+ test_merge merge-commit --no-ff f &&
+ git checkout -b f1 &&
+ echo on-f1 >f1.txt &&
+ git add f1.txt &&
+ test_commit --no-tag f1 f1.txt &&
+ git checkout merge-branch &&
+ git checkout -b f2 &&
+ echo on-f2 >f2.txt &&
+ git add f2.txt &&
+ test_commit --no-tag f2 f2.txt &&
+ git checkout merge-branch &&
+ test_merge octopus-merge --no-ff f1 f2 &&
+ git branch -D f f1 f2 &&
+ git checkout "$original"
+'
+
+test_expect_success 'log --diff-merges' '
+ git log -1 merge-commit >expect &&
+ echo >>expect &&
+ git diff merge-commit^1 merge-commit >>expect &&
+ git log -1 --diff-merges=first-parent \
+ merge-commit >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'log --diff-merges NUL terminated' '
+ git log -1 --format=%s merge-commit >expect &&
+ git diff merge-commit^1 merge-commit >>expect &&
+ printf "\0" >>expect &&
+ git log -1 -z --format=%s --diff-merges=first-parent \
+ merge-commit >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'log --remerge-diff octopus merge' '
+ git log -1 octopus-merge >expect &&
+ echo "diff: warning: Skipping remerge-diff for octopus merges." \
+ >>expect &&
+ git log -1 --remerge-diff octopus-merge >actual &&
+ test_cmp expect actual
+'
+
+# Later tests depend on what tags you have
+test_expect_success 'setup: clean up --diff-merges' '
+ git tag -d merge-commit &&
+ git tag -d octopus-merge
+'
+
test_expect_success 'setup more commits' '
test_commit "message one" one one message-one &&
test_commit "message two" two two message-two &&
--
2.56.1.5.g155936fbb2a
next prev parent reply other threads:[~2026-12-02 22:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 22:14 [PATCH 00/12] revision: learn -Z for NUL termination kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 01/12] t4205: use correct 'setup' keyword kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 02/12] t4205: add test coverage for NUL separator and --patch kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 03/12] t4205: test blank line between commit and diff explicitly kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 04/12] t4013-diff-various.sh: test --stdin -z --patch kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 05/12] log-tree: terminate cmt+diff when " kristofferhaugsbakk
2026-12-02 22:14 ` kristofferhaugsbakk [this message]
2026-12-02 22:14 ` [PATCH 07/12] revision: learn -Z for NUL termination kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 08/12] revision: split out termination character kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 09/12] diff-tree: flush each diff when --stdin kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 10/12] doc: diff-tree: tell about --no-commit-id in Description kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 11/12] doc: diff-tree: add Examples section and mention --stdin kristofferhaugsbakk
2026-12-02 22:14 ` [PATCH 12/12] doc: rev-list: complete diff-tree by mentioning --always kristofferhaugsbakk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=test_--diff-merges.df5@m5gid.xyz \
--to=kristofferhaugsbakk@fastmail.com \
--cc=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox