All of lore.kernel.org
 help / color / mirror / Atom feed
From: kristofferhaugsbakk@fastmail.com
To: git@vger.kernel.org
Cc: Kristoffer Haugsbakk <code@khaugsbakk.name>
Subject: [PATCH 02/12] t4205: add test coverage for NUL separator and --patch
Date: Wed,  2 Dec 2026 23:14:10 +0100	[thread overview]
Message-ID: <NUL_sep._and_--patch.df1@m5gid.xyz> (raw)
In-Reply-To: <CV_diff-tree_NUL_termination.def@m5gid.xyz>

From: Kristoffer Haugsbakk <code@khaugsbakk.name>

There is no test coverage for option -z combined with the default commit
format (medium) and user-defined pretty formats using separator.

This is relevant since we are about to change how -z, --patch, and
NUL *termination* works in an upcoming commit.[1]

† 1: commit “log-tree: terminate cmt+diff when -z --patch”

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
---
 t/t4205-log-pretty-formats.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 3ef184d7879..5048c3b4c39 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -138,6 +138,22 @@ test_expect_success 'NUL separation with --stat' '
 	test_cmp expected actual
 '
 
+test_expect_success 'NUL separation with --patch' '
+	diff0_part=$(git diff HEAD^ HEAD) &&
+	diff1_part=$(git diff-tree --no-commit-id --patch --root HEAD^) &&
+	printf "add bar\n${diff0_part}\n\0$(commit_msg)\n${diff1_part}\n" >expected &&
+	git log -z --patch --pretty="format:%s" >actual &&
+	test_cmp_bin expected actual
+'
+
+test_expect_success 'NUL separation with --format=medium --patch' '
+	git show HEAD >expected &&
+	printf "\0" >>expected &&
+	git show HEAD^ >>expected &&
+	git log -z --patch >actual &&
+	test_cmp_bin expected actual
+'
+
 test_expect_failure 'NUL termination with --stat' '
 	stat0_part=$(git diff --stat HEAD^ HEAD) &&
 	stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
-- 
2.56.1.5.g155936fbb2a


  parent reply	other threads:[~2026-12-02 22:15 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 ` kristofferhaugsbakk [this message]
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 ` [PATCH 06/12] t4205: test --diff-merges kristofferhaugsbakk
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=NUL_sep._and_--patch.df1@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.