Git development
 help / color / mirror / Atom feed
From: kristofferhaugsbakk@fastmail.com
To: git@vger.kernel.org
Cc: Kristoffer Haugsbakk <code@khaugsbakk.name>, ben.knoble@gmail.com
Subject: [PATCH v3 4/5] name-rev: make dedicated --annotate-stdin --name-only test
Date: Wed, 29 Apr 2026 00:25:55 +0200	[thread overview]
Message-ID: <V3_name-rev_dedicated_test.66e@msgid.xyz> (raw)
In-Reply-To: <V3_CV_format-rev.66a@msgid.xyz>

From: Kristoffer Haugsbakk <code@khaugsbakk.name>

The previous commit split the `--name-only` handling:

1. `--annotate-stdin`: uses the new `struct command`
2. The rest: uses `struct name_ref_data`

But there is no dedicated test for the option combination in (1). That
means that the following tests will fail if you neglect to set
`command.u.name_only` properly:

    name-rev --annotate-stdin works with commitGraph
    name-rev --annotate-stdin works with non-monotonic timestamps

even though it has nothing to do with what these tests are supposed
to test.

Let’s add another regression test now that it is relevant.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
---
 t/t6120-describe.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 2c70cc561ad..62789f76381 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -298,6 +298,20 @@ test_expect_success 'name-rev --annotate-stdin' '
 	test_cmp expect actual
 '
 
+test_expect_success 'name-rev --annotate-stdin --name-only' '
+	>expect.unsorted &&
+	for rev in $(git rev-list --all)
+	do
+		name=$(git name-rev --name-only $rev) &&
+		echo "$name" >>expect.unsorted || return 1
+	done &&
+	sort <expect.unsorted >expect &&
+	git name-rev --annotate-stdin --name-only \
+		<list >actual.unsorted &&
+	sort <actual.unsorted >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'name-rev --stdin deprecated' '
 	git rev-list --all >list &&
 	if ! test_have_prereq WITH_BREAKING_CHANGES
-- 
2.54.0.13.g9c7419e39f8


  parent reply	other threads:[~2026-04-28 22:27 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 16:03 [PATCH 0/2] name-rev: learn --format=<pretty> kristofferhaugsbakk
2026-03-13 16:03 ` [PATCH 1/2] name-rev: wrap both blocks in braces kristofferhaugsbakk
2026-03-14  0:22   ` Junio C Hamano
2026-03-17 22:10     ` Kristoffer Haugsbakk
2026-03-13 16:03 ` [PATCH 2/2] name-rev: learn --format=<pretty> kristofferhaugsbakk
2026-03-14  0:22   ` Junio C Hamano
2026-03-17 22:07     ` Kristoffer Haugsbakk
2026-03-18 15:36       ` Kristoffer Haugsbakk
2026-03-20 13:09 ` [PATCH v2 0/2] " kristofferhaugsbakk
2026-03-20 13:09   ` [PATCH v2 1/2] name-rev: wrap both blocks in braces kristofferhaugsbakk
2026-03-20 13:09   ` [PATCH v2 2/2] name-rev: learn --format=<pretty> kristofferhaugsbakk
2026-03-20 15:25     ` D. Ben Knoble
2026-03-23 17:34       ` Kristoffer Haugsbakk
2026-04-28 22:25   ` [PATCH v3 0/5] format-rev: introduce builtin for on-demand pretty formatting kristofferhaugsbakk
2026-04-28 22:25     ` [PATCH v3 1/5] name-rev: wrap both blocks in braces kristofferhaugsbakk
2026-04-28 22:25     ` [PATCH v3 2/5] name-rev: run clang-format before factoring code kristofferhaugsbakk
2026-04-28 22:25     ` [PATCH v3 3/5] name-rev: factor code for sharing with a new command kristofferhaugsbakk
2026-04-30 13:54       ` Phillip Wood
2026-05-01 17:24         ` kristofferhaugsbakk
2026-05-02 10:00           ` Phillip Wood
2026-05-05 19:21             ` Kristoffer Haugsbakk
2026-04-28 22:25     ` kristofferhaugsbakk [this message]
2026-04-28 22:25     ` [PATCH v3 5/5] format-rev: introduce builtin for on-demand pretty formatting kristofferhaugsbakk
2026-04-29 13:41       ` Kristoffer Haugsbakk
2026-04-30  6:23         ` Kristoffer Haugsbakk
2026-04-30  9:21       ` Kristoffer Haugsbakk
2026-05-01 10:16       ` Phillip Wood
2026-05-01 18:27         ` kristofferhaugsbakk
2026-05-02 10:00           ` Phillip Wood
2026-05-05 19:27             ` Kristoffer Haugsbakk
2026-05-03 19:19       ` Junio C Hamano
2026-05-07 19:34     ` [PATCH v4 0/5] " kristofferhaugsbakk
2026-05-07 19:34       ` [PATCH v4 1/5] name-rev: wrap both blocks in braces kristofferhaugsbakk
2026-05-07 19:34       ` [PATCH v4 2/5] name-rev: run clang-format before factoring code kristofferhaugsbakk
2026-05-07 19:34       ` [PATCH v4 3/5] name-rev: factor code for sharing with a new command kristofferhaugsbakk
2026-05-07 19:34       ` [PATCH v4 4/5] name-rev: make dedicated --annotate-stdin --name-only test kristofferhaugsbakk
2026-05-07 19:34       ` [PATCH v4 5/5] format-rev: introduce builtin for on-demand pretty formatting kristofferhaugsbakk
2026-05-08 13:25         ` Kristoffer Haugsbakk
2026-05-11 13:25         ` Kristoffer Haugsbakk
2026-05-11 15:45       ` [PATCH v5 0/5] " kristofferhaugsbakk
2026-05-11 15:45         ` [PATCH v5 1/5] name-rev: wrap both blocks in braces kristofferhaugsbakk
2026-05-11 15:45         ` [PATCH v5 2/5] name-rev: run clang-format before factoring code kristofferhaugsbakk
2026-05-11 15:45         ` [PATCH v5 3/5] name-rev: factor code for sharing with a new command kristofferhaugsbakk
2026-05-11 15:45         ` [PATCH v5 4/5] name-rev: make dedicated --annotate-stdin --name-only test kristofferhaugsbakk
2026-05-11 15:45         ` [PATCH v5 5/5] format-rev: introduce builtin for on-demand pretty formatting 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=V3_name-rev_dedicated_test.66e@msgid.xyz \
    --to=kristofferhaugsbakk@fastmail.com \
    --cc=ben.knoble@gmail.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