summaryrefslogtreecommitdiff
path: root/include/git2/commit.h
diff options
context:
space:
mode:
authorTyler Wanek <tylerw@axosoft.com>2019-01-24 08:42:25 -0700
committerTyler Wanek <tylerw@axosoft.com>2019-01-24 08:42:25 -0700
commit0d06bf4852a3b943a40c6378f638b7f0bb8972b9 (patch)
tree88392104bb3c20f28dc19eb089985fc7f7e9bd90 /include/git2/commit.h
parent3a8ef8240f2bf93876d867d4db98c1f30180fe67 (diff)
downloadlibgit2-0d06bf4852a3b943a40c6378f638b7f0bb8972b9.tar.gz
fixup: More generic signing_cb for future flexibility
In the case that we want to build merge + commit, cherrypick + commit, or even just build a commit with signing callback, `git_rebase_commit_signature_cb` particular callback should be made more generic. We also renamed `signature_cb` to `signing_cb` to improve clarity on the purpose of the callback (build a difference between a git_signature and the act of signing). So we've ended up with `git_commit_signing_cb`.
Diffstat (limited to 'include/git2/commit.h')
-rw-r--r--include/git2/commit.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/git2/commit.h b/include/git2/commit.h
index 7e0409cc7..a50ff58ce 100644
--- a/include/git2/commit.h
+++ b/include/git2/commit.h
@@ -501,6 +501,21 @@ GIT_EXTERN(int) git_commit_create_with_signature(
*/
GIT_EXTERN(int) git_commit_dup(git_commit **out, git_commit *source);
+/**
+ * Commit signing callback.
+ *
+ * The callback will be called with the commit content, giving a user an
+ * opportunity to sign the commit content. The signature_field
+ * buf may be left empty to specify the default field.
+ *
+ * When the callback:
+ * - returns GIT_PASSTHROUGH, no signature will be added to the commit.
+ * - returns < 0, commit creation will be aborted.
+ * - returns GIT_OK, the signature parameter is expected to be filled.
+ */
+typedef int (*git_commit_signing_cb)(
+ git_buf *signature, git_buf *signature_field, const char *commit_content, void *payload);
+
/** @} */
GIT_END_DECL
#endif