public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Christian Couder <christian.couder@gmail•com>
To: git@vger•kernel.org
Cc: Junio C Hamano <gitster@pobox•com>,
	Patrick Steinhardt <ps@pks•im>, Elijah Newren <newren@gmail•com>,
	Jeff King <peff@peff•net>,
	"brian m . carlson" <sandals@crustytoothpaste•net>,
	Johannes Schindelin <Johannes.Schindelin@gmx•de>,
	Christian Couder <christian.couder@gmail•com>,
	Christian Couder <chriscool@tuxfamily•org>
Subject: [PATCH 3/5] t9350: properly count annotated tags
Date: Tue,  7 Oct 2025 14:29:56 +0200	[thread overview]
Message-ID: <20251007122958.1089680-4-christian.couder@gmail.com> (raw)
In-Reply-To: <20251007122958.1089680-1-christian.couder@gmail.com>

In t9350-fast-export.sh, these existing tests:

  - 'fast-export | fast-import when main is tagged'
  - 'cope with tagger-less tags'

are checking the number of annotated tags in the test repo by comparing
it with some hardcoded values.

This could be an issue if some new tests that have some prerequisites
add new annotated tags to the repo before these existing tests. When
the prerequisites would be satisfied, the number of annotated tags
would be different from when some prerequisites would not be satisfied.

As we are going to add new tests that add new annotated tags in a
following commit, let's properly count the number of annotated tag in
the repo by incrementing a counter each time a new annotated tag is
added, and then by comparing the number of annotated tags to the value
of the counter when checking the number of annotated tags.

Signed-off-by: Christian Couder <chriscool@tuxfamily•org>
---
 t/t9350-fast-export.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index 8f85c69d62..21ff26939c 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -35,6 +35,7 @@ test_expect_success 'setup' '
 	git commit -m sitzt file2 &&
 	test_tick &&
 	git tag -a -m valentin muss &&
+	ANNOTATED_TAG_COUNT=1 &&
 	git merge -s ours main
 
 '
@@ -229,7 +230,8 @@ EOF
 
 test_expect_success 'set up faked signed tag' '
 
-	git fast-import <signed-tag-import
+	git fast-import <signed-tag-import &&
+	ANNOTATED_TAG_COUNT=$((ANNOTATED_TAG_COUNT + 1))
 
 '
 
@@ -491,8 +493,9 @@ test_expect_success 'fast-export -C -C | fast-import' '
 test_expect_success 'fast-export | fast-import when main is tagged' '
 
 	git tag -m msg last &&
+	ANNOTATED_TAG_COUNT=$((ANNOTATED_TAG_COUNT + 1)) &&
 	git fast-export -C -C --signed-tags=strip --all > output &&
-	test $(grep -c "^tag " output) = 3
+	test $(grep -c "^tag " output) = $ANNOTATED_TAG_COUNT
 
 '
 
@@ -506,12 +509,13 @@ test_expect_success 'cope with tagger-less tags' '
 
 	TAG=$(git hash-object --literally -t tag -w tag-content) &&
 	git update-ref refs/tags/sonnenschein $TAG &&
+	ANNOTATED_TAG_COUNT=$((ANNOTATED_TAG_COUNT + 1)) &&
 	git fast-export -C -C --signed-tags=strip --all > output &&
-	test $(grep -c "^tag " output) = 4 &&
+	test $(grep -c "^tag " output) = $ANNOTATED_TAG_COUNT &&
 	! grep "Unspecified Tagger" output &&
 	git fast-export -C -C --signed-tags=strip --all \
 		--fake-missing-tagger > output &&
-	test $(grep -c "^tag " output) = 4 &&
+	test $(grep -c "^tag " output) = $ANNOTATED_TAG_COUNT &&
 	grep "Unspecified Tagger" output
 
 '
-- 
2.51.0.438.g6987fc0bae


  parent reply	other threads:[~2025-10-07 12:30 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-07 12:29 [PATCH 0/5] fast-import: start controlling how tag signatures are handled Christian Couder
2025-10-07 12:29 ` [PATCH 1/5] doc: git-tag: stop focussing on GPG signed tags Christian Couder
2025-10-08  7:14   ` Patrick Steinhardt
2025-10-08  9:52     ` Christian Couder
2025-10-08 11:48       ` Patrick Steinhardt
2025-10-07 12:29 ` [PATCH 2/5] lib-gpg: allow tests with the GPGSM prereq first Christian Couder
2025-10-08  7:14   ` Patrick Steinhardt
2025-10-08  9:42     ` Christian Couder
2025-10-09  1:29       ` Collin Funk
2025-10-09  2:37         ` Todd Zullinger
2025-10-09 12:29           ` Christian Couder
2025-10-09 18:18           ` Junio C Hamano
2025-10-09 12:30         ` Christian Couder
2025-10-07 12:29 ` Christian Couder [this message]
2025-10-08  7:14   ` [PATCH 3/5] t9350: properly count annotated tags Patrick Steinhardt
2025-10-08 10:00     ` Christian Couder
2025-10-07 12:29 ` [PATCH 4/5] fast-export: handle all kinds of tag signatures Christian Couder
2025-10-08  7:14   ` Patrick Steinhardt
2025-10-08 10:02     ` Christian Couder
2025-10-09 12:33     ` Christian Couder
2025-10-07 12:29 ` [PATCH 5/5] fast-import: add '--signed-tags=<mode>' option Christian Couder
2025-10-08  7:14   ` Patrick Steinhardt
2025-10-08 10:50     ` Christian Couder
2025-10-08 11:53       ` Patrick Steinhardt
2025-10-09 12:24 ` [PATCH v2 0/5] fast-import: start controlling how tag signatures are handled Christian Couder
2025-10-09 12:24   ` [PATCH v2 1/5] doc: git-tag: stop focusing on GPG signed tags Christian Couder
2025-10-10  1:19     ` Junio C Hamano
2025-10-10  7:06       ` Christian Couder
2025-10-09 12:24   ` [PATCH v2 2/5] lib-gpg: allow tests with GPGSM or GPGSSH prereq first Christian Couder
2025-10-10  6:49     ` Patrick Steinhardt
2025-10-10 14:09       ` Todd Zullinger
2025-10-10 16:22         ` Junio C Hamano
2025-10-11  2:14           ` Todd Zullinger
2025-10-12  0:15             ` Junio C Hamano
2025-10-09 12:24   ` [PATCH v2 3/5] t9350: properly count annotated tags Christian Couder
2025-10-09 12:24   ` [PATCH v2 4/5] fast-export: handle all kinds of tag signatures Christian Couder
2025-10-09 12:24   ` [PATCH v2 5/5] fast-import: add '--signed-tags=<mode>' option Christian Couder
2025-10-09 21:35   ` [PATCH v2 0/5] fast-import: start controlling how tag signatures are handled Junio C Hamano
2025-10-13  8:48 ` [PATCH v3 " Christian Couder
2025-10-13  8:48   ` [PATCH v3 1/5] doc: git-tag: stop focusing on GPG signed tags Christian Couder
2025-10-24  2:03     ` Elijah Newren
2025-10-13  8:48   ` [PATCH v3 2/5] lib-gpg: allow tests with GPGSM or GPGSSH prereq first Christian Couder
2025-10-13  8:48   ` [PATCH v3 3/5] t9350: properly count annotated tags Christian Couder
2025-10-24  2:03     ` Elijah Newren
2025-10-13  8:48   ` [PATCH v3 4/5] fast-export: handle all kinds of tag signatures Christian Couder
2025-10-24  2:03     ` Elijah Newren
2025-10-13  8:48   ` [PATCH v3 5/5] fast-import: add '--signed-tags=<mode>' option Christian Couder
2025-10-24  2:03     ` Elijah Newren
2025-10-24  9:27       ` Christian Couder
2025-10-24 15:03       ` Junio C Hamano
2025-10-13  9:09   ` [PATCH v3 0/5] fast-import: start controlling how tag signatures are handled Christian Couder
2025-10-24  2:06     ` Elijah Newren

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=20251007122958.1089680-4-christian.couder@gmail.com \
    --to=christian.couder@gmail$(echo .)com \
    --cc=Johannes.Schindelin@gmx$(echo .)de \
    --cc=chriscool@tuxfamily$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=newren@gmail$(echo .)com \
    --cc=peff@peff$(echo .)net \
    --cc=ps@pks$(echo .)im \
    --cc=sandals@crustytoothpaste$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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