summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-08-29 10:14:01 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-08-29 10:16:56 -0400
commitef03e15038824c8951eede2f17ad9dafbd5a32d3 (patch)
treecfc3926004f3fd402a1903b3657912ccfff53b57 /include
parentd3bdf33b58f16939a4fd43ab541dcd2ee535b6a3 (diff)
downloadlibgit2-ef03e15038824c8951eede2f17ad9dafbd5a32d3.tar.gz
rebase: deprecate signing_cbethomson/commit_create_cb
The signing callback should not be used; instead, callers should provide a commit_create_cb, perform the signing and commit creation themselves.
Diffstat (limited to 'include')
-rw-r--r--include/git2/commit.h21
-rw-r--r--include/git2/deprecated.h21
-rw-r--r--include/git2/rebase.h11
3 files changed, 31 insertions, 22 deletions
diff --git a/include/git2/commit.h b/include/git2/commit.h
index 650bf65a5..4d74b8994 100644
--- a/include/git2/commit.h
+++ b/include/git2/commit.h
@@ -539,27 +539,6 @@ typedef int (*git_commit_create_cb)(
const git_commit *parents[],
void *payload);
-/**
- * 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 "gpgsig".
- *
- * Signatures can take the form of any string, and can be created on an arbitrary
- * header field. Signatures are most commonly used for verifying authorship of a
- * commit using GPG or a similar cryptographically secure signing algorithm.
- * See https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work for more
- * details.
- *
- * 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
diff --git a/include/git2/deprecated.h b/include/git2/deprecated.h
index ac60488ac..611848e10 100644
--- a/include/git2/deprecated.h
+++ b/include/git2/deprecated.h
@@ -205,6 +205,27 @@ GIT_EXTERN(void) git_buf_free(git_buf *buffer);
/**@}*/
+/** @name Deprecated Commit Definitions
+ */
+/**@{*/
+
+/**
+ * Provide a commit signature during commit creation.
+ *
+ * Callers should instead define a `git_commit_create_cb` that
+ * generates a commit buffer using `git_commit_create_buffer`, sign
+ * that buffer and call `git_commit_create_with_signature`.
+ *
+ * @deprecated use a `git_commit_create_cb` instead
+ */
+typedef int (*git_commit_signing_cb)(
+ git_buf *signature,
+ git_buf *signature_field,
+ const char *commit_content,
+ void *payload);
+
+/**@}*/
+
/** @name Deprecated Config Functions and Constants
*/
/**@{*/
diff --git a/include/git2/rebase.h b/include/git2/rebase.h
index 7d2d5de69..11e452cbf 100644
--- a/include/git2/rebase.h
+++ b/include/git2/rebase.h
@@ -86,17 +86,26 @@ typedef struct {
*/
git_commit_create_cb commit_create_cb;
+#ifdef GIT_DEPRECATE_HARD
+ void *reserved;
+#else
/**
* If provided, this will be called with the commit content, allowing
* a signature to be added to the rebase commit. Can be skipped with
* GIT_PASSTHROUGH. If GIT_PASSTHROUGH is returned, a commit will be made
* without a signature.
+ *
* This field is only used when performing git_rebase_commit.
*
* This callback is not invoked if a `git_commit_create_cb` is
* specified.
+ *
+ * This callback is deprecated; users should provide a
+ * creation callback as `commit_create_cb` that produces a
+ * commit buffer, signs it, and commits it.
*/
- git_commit_signing_cb signing_cb;
+ int (*signing_cb)(git_buf *, git_buf *, const char *, void *);
+#endif
/**
* This will be passed to each of the callbacks in this struct