]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit: export add_header_signature to support handling signatures on tags
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 2 Oct 2023 02:40:15 +0000 (21:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Oct 2023 21:57:39 +0000 (14:57 -0700)
Rename add_commit_signature as add_header_signature, and expose it so
that it can be used for converting tags from one object format to
another.

Inspired-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c
commit.h

index 913e015966b4b96add5e6e1a2debc59aed3e0028..2b61a4d0aa11b02869d13ff906605264a112b281 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1101,7 +1101,7 @@ static const char *gpg_sig_headers[] = {
        "gpgsig-sha256",
 };
 
-static int add_commit_signature(struct strbuf *buf, struct strbuf *sig, const struct git_hash_algo *algo)
+int add_header_signature(struct strbuf *buf, struct strbuf *sig, const struct git_hash_algo *algo)
 {
        int inspos, copypos;
        const char *eoh;
@@ -1770,9 +1770,9 @@ int commit_tree_extended(const char *msg, size_t msg_len,
                for (i = 0; i < ARRAY_SIZE(bufs); i++) {
                        if (!bufs[i].algo)
                                continue;
-                       add_commit_signature(&buffer, bufs[i].sig, bufs[i].algo);
+                       add_header_signature(&buffer, bufs[i].sig, bufs[i].algo);
                        if (r->compat_hash_algo)
-                               add_commit_signature(&compat_buffer, bufs[i].sig, bufs[i].algo);
+                               add_header_signature(&compat_buffer, bufs[i].sig, bufs[i].algo);
                }
        }
 
index 28928833c544081f9c08971f7a4450e97154ebb3..03edcec0129f8ed4b033c8d512a6103ca9c99a08 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -370,5 +370,6 @@ int parse_buffer_signed_by_header(const char *buffer,
                                  struct strbuf *payload,
                                  struct strbuf *signature,
                                  const struct git_hash_algo *algop);
+int add_header_signature(struct strbuf *buf, struct strbuf *sig, const struct git_hash_algo *algo);
 
 #endif /* COMMIT_H */