From: Junio C Hamano <gitster@pobox.com>
To: Scott Chacon <scott@gitbutler.net>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH 2/4] tag: add --hash=sha256 to sign a tree-sha256 header
Date: Fri, 02 Oct 2026 08:49:18 -0700 [thread overview]
Message-ID: <xmqqo6dcyuf5.fsf@gitster.g> (raw)
In-Reply-To: <20261002081846.25144-3-scott@gitbutler.net> (Scott Chacon's message of "Fri, 2 Oct 2026 10:18:44 +0200")
Scott Chacon <scott@gitbutler.net> writes:
> @@ -316,11 +318,19 @@ static void create_tag(const struct object_id *object, const char *object_ref,
> "object %s\n"
> "type %s\n"
> "tag %s\n"
> - "tagger %s\n\n",
> + "tagger %s\n",
> oid_to_hex(object),
> type_name(type),
> tag,
> git_committer_info(IDENT_STRICT));
> + if (opt->sign && opt->tree_hash) {
> + strbuf_addstr(&header, TREE_SHA256_HEADER " ");
> + if (tree_sha256_hex(the_repository, object, &header))
> + die(_("unable to compute %s for %s"),
> + TREE_SHA256_HEADER, object_ref);
> + strbuf_addch(&header, '\n');
> + }
> + strbuf_addch(&header, '\n');
This is a very nice reorganization. The hardcoded double LF at the
end was a declaration that we wanted to make it hard to add new
fields, but it becomes a hindrance when we want to add an optional
field.
next prev parent reply other threads:[~2026-10-02 15:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 8:18 [RFC PATCH 0/4] sign a SHA-256 digest of the tree in commits and tags Scott Chacon
2026-10-02 8:18 ` [RFC PATCH 1/4] tree-sha256: hash the contents of a tree with SHA-256 Scott Chacon
2026-10-02 15:45 ` Junio C Hamano
2026-10-02 8:18 ` [RFC PATCH 2/4] tag: add --hash=sha256 to sign a tree-sha256 header Scott Chacon
2026-10-02 15:49 ` Junio C Hamano [this message]
2026-10-02 8:18 ` [RFC PATCH 3/4] commit: " Scott Chacon
2026-10-02 8:18 ` [RFC PATCH 4/4] gpg: add gpg.treeHash to sign a tree-sha256 header by default Scott Chacon
2026-10-02 15:52 ` [RFC PATCH 0/4] sign a SHA-256 digest of the tree in commits and tags Junio C Hamano
2026-10-02 19:06 ` brian m. carlson
2026-10-05 9:32 ` Scott Chacon
2026-10-05 12:41 ` Patrick Steinhardt
2026-10-05 14:16 ` Scott Chacon
2026-10-05 22:57 ` brian m. carlson
2026-10-06 13:36 ` Johannes Schindelin
2026-10-06 16:16 ` Kristoffer Haugsbakk
2026-10-06 21:55 ` brian m. carlson
2026-10-06 22:38 ` Junio C Hamano
2026-10-06 23:40 ` brian m. carlson
2026-10-06 9:00 ` Christian Couder
2026-10-06 22:26 ` brian m. carlson
2026-10-07 12:26 ` Christian Couder
2026-10-07 21:07 ` brian m. carlson
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=xmqqo6dcyuf5.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=scott@gitbutler.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