git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Christian Couder <christian.couder@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Elijah Newren <newren@gmail.com>, Jeff King <peff@peff.net>,
	"brian m . carlson" <sandals@crustytoothpaste.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH 4/5] fast-export: handle all kinds of tag signatures
Date: Wed, 8 Oct 2025 09:14:34 +0200	[thread overview]
Message-ID: <aOYPWvdE4VnL8T7z@pks.im> (raw)
In-Reply-To: <20251007122958.1089680-5-christian.couder@gmail.com>

On Tue, Oct 07, 2025 at 02:29:57PM +0200, Christian Couder wrote:
> diff --git a/builtin/fast-export.c b/builtin/fast-export.c
> index dc2486f9a8..7adbc55f0d 100644
> --- a/builtin/fast-export.c
> +++ b/builtin/fast-export.c
> @@ -931,9 +931,8 @@ static void handle_tag(const char *name, struct tag *tag)
>  
>  	/* handle signed tags */
>  	if (message) {
> -		const char *signature = strstr(message,
> -					       "\n-----BEGIN PGP SIGNATURE-----\n");
> -		if (signature)
> +		size_t sig_offset = parse_signed_buffer(message, message_size);
> +		if (sig_offset < message_size)

Yup. The function either returns `message_size` in case there is no
signature, or it returns the offset at which the signature starts.

>  			switch (signed_tag_mode) {
>  			case SIGN_ABORT:
>  				die("encountered signed tag %s; use "

I was afraid at first that we're now open-coding all these different
signature formats. But this implementation makes me quite happy, as we
even remove the existing check instead of using a central function.
Nice.

> @@ -950,7 +949,7 @@ static void handle_tag(const char *name, struct tag *tag)
>  					oid_to_hex(&tag->object.oid));
>  				/* fallthru */
>  			case SIGN_STRIP:
> -				message_size = signature + 1 - message;
> +				message_size = sig_offset;
>  				break;
>  			}
>  	}

Makes sense.

> diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
> index 21ff26939c..5a46608f65 100755
> --- a/t/t9350-fast-export.sh
> +++ b/t/t9350-fast-export.sh
> @@ -279,6 +279,54 @@ test_expect_success 'signed-tags=warn-strip' '
>  	test -s err
>  '
>  
> +test_expect_success GPGSM 'setup X.509 signed tag' '
> +
> +	test_config gpg.format x509 &&
> +	test_config user.signingkey $GIT_COMMITTER_EMAIL &&
> +
> +	git tag -s -m "X.509 signed tag" x509-signed $(git rev-parse HEAD) &&
> +	ANNOTATED_TAG_COUNT=$((ANNOTATED_TAG_COUNT + 1))
> +
> +'

Nit for this test and all of the below ones: our modern style does not
have empty lines at the beginning and end of a test case.

Patrick

  reply	other threads:[~2025-10-08  7:14 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 ` [PATCH 3/5] t9350: properly count annotated tags Christian Couder
2025-10-08  7:14   ` 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 [this message]
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=aOYPWvdE4VnL8T7z@pks.im \
    --to=ps@pks.im \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /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;
as well as URLs for NNTP newsgroup(s).