diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2021-02-11 05:08:04 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-11 10:35:42 +0300 |
commit | 937032e14aaf1eab59c96dd78938be1c48c648e1 (patch) | |
tree | e2ce5104c34e1ea5b1fafe21ecf68d1d31eae252 /commit.h | |
parent | 482c119186987110bfccf705a5ac75d399b08766 (diff) |
commit: allow parsing arbitrary buffers with headers
Currently only commits are signed with headers. However, in the future,
we'll also sign tags with headers as well. Let's refactor out a
function called parse_buffer_signed_by_header which does exactly that.
In addition, since we'll want to sign things other than commits this
way, let's call the function sign_with_header instead of do_sign_commit.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
-rw-r--r-- | commit.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -360,4 +360,13 @@ int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void LAST_ARG_MUST_BE_NULL int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...); +/* Sign a commit or tag buffer, storing the result in a header. */ +int sign_with_header(struct strbuf *buf, const char *keyid); +/* Parse the signature out of a header. */ +int parse_buffer_signed_by_header(const char *buffer, + unsigned long size, + struct strbuf *payload, + struct strbuf *signature, + const struct git_hash_algo *algop); + #endif /* COMMIT_H */ |