From: Junio C Hamano Date: Fri, 02 Oct 2026 15:49:18 GMT Subject: Re: [RFC PATCH 2/4] tag: add --hash=sha256 to sign a tree-sha256 header Message-ID: In-Reply-To: <20261002081846.25144-3-scott@gitbutler.net> Scott Chacon 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.