Skip to content

Commit 6bcc5fa

Browse files
ebiedermgitster
authored andcommitted
commit: export add_header_signature to support handling signatures on tags
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 <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a3e8ae5 commit 6bcc5fa

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

commit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ static const char *gpg_sig_headers[] = {
11011101
"gpgsig-sha256",
11021102
};
11031103

1104-
static int add_commit_signature(struct strbuf *buf, struct strbuf *sig, const struct git_hash_algo *algo)
1104+
int add_header_signature(struct strbuf *buf, struct strbuf *sig, const struct git_hash_algo *algo)
11051105
{
11061106
int inspos, copypos;
11071107
const char *eoh;
@@ -1770,9 +1770,9 @@ int commit_tree_extended(const char *msg, size_t msg_len,
17701770
for (i = 0; i < ARRAY_SIZE(bufs); i++) {
17711771
if (!bufs[i].algo)
17721772
continue;
1773-
add_commit_signature(&buffer, bufs[i].sig, bufs[i].algo);
1773+
add_header_signature(&buffer, bufs[i].sig, bufs[i].algo);
17741774
if (r->compat_hash_algo)
1775-
add_commit_signature(&compat_buffer, bufs[i].sig, bufs[i].algo);
1775+
add_header_signature(&compat_buffer, bufs[i].sig, bufs[i].algo);
17761776
}
17771777
}
17781778

commit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,5 +370,6 @@ int parse_buffer_signed_by_header(const char *buffer,
370370
struct strbuf *payload,
371371
struct strbuf *signature,
372372
const struct git_hash_algo *algop);
373+
int add_header_signature(struct strbuf *buf, struct strbuf *sig, const struct git_hash_algo *algo);
373374

374375
#endif /* COMMIT_H */

0 commit comments

Comments
 (0)