diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-08-29 09:36:01 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-08-29 10:16:29 -0400 |
commit | d3bdf33b58f16939a4fd43ab541dcd2ee535b6a3 (patch) | |
tree | 3e4016f2bbaa68a370a928f0524bf3c5845d6025 /include/git2/commit.h | |
parent | 0a79012e9df33db31046c653ab04c69eaeed200a (diff) | |
download | libgit2-d3bdf33b58f16939a4fd43ab541dcd2ee535b6a3.tar.gz |
rebase: introduce git_commit_create_cb
Introduce a new mechanism for `git_rebase_commit` for callers to
customize the experience. Instead of assuming that we produce the
commit for them, provide a commit creation callback that allows callers
to produce the commit themselves and return the resulting commit id.
Diffstat (limited to 'include/git2/commit.h')
-rw-r--r-- | include/git2/commit.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/git2/commit.h b/include/git2/commit.h index e6c4656a9..650bf65a5 100644 --- a/include/git2/commit.h +++ b/include/git2/commit.h @@ -503,6 +503,43 @@ GIT_EXTERN(int) git_commit_create_with_signature( GIT_EXTERN(int) git_commit_dup(git_commit **out, git_commit *source); /** + * Commit creation callback: used when a function is going to create + * commits (for example, in `git_rebase_commit`) to allow callers to + * override the commit creation behavior. For example, users may + * wish to sign commits by providing this information to + * `git_commit_create_buffer`, signing that buffer, then calling + * `git_commit_create_with_signature`. The resultant commit id + * should be set in the `out` object id parameter. + * + * @param out pointer that this callback will populate with the object + * id of the commit that is created + * @param author the author name and time of the commit + * @param committer the committer name and time of the commit + * @param message_encoding the encoding of the given message, or NULL + * to assume UTF8 + * @param message the commit message + * @param tree the tree to be committed + * @param parent_count the number of parents for this commit + * @param parents the commit parents + * @param payload the payload pointer in the rebase options + * @return 0 if this callback has created the commit and populated the out + * parameter, GIT_PASSTHROUGH if the callback has not created a + * commit and wants the calling function to create the commit as + * if no callback had been specified, any other value to stop + * and return a failure + */ +typedef int (*git_commit_create_cb)( + git_oid *out, + const git_signature *author, + const git_signature *committer, + const char *message_encoding, + const char *message, + const git_tree *tree, + size_t parent_count, + const git_commit *parents[], + void *payload); + +/** * Commit signing callback. * * The callback will be called with the commit content, giving a user an |