1 /* 2 * Copyright (C) the libgit2 contributors. All rights reserved. 3 * 4 * This file is part of libgit2, distributed under the GNU GPL v2 with 5 * a Linking Exception. For full terms see the included COPYING file. 6 */ 7 #ifndef INCLUDE_sys_git_commit_h__ 8 #define INCLUDE_sys_git_commit_h__ 9 10 #include "git2/common.h" 11 #include "git2/types.h" 12 #include "git2/oid.h" 13 14 /** 15 * @file git2/sys/commit.h 16 * @brief Low-level Git commit creation 17 * @defgroup git_backend Git custom backend APIs 18 * @ingroup Git 19 * @{ 20 */ 21 GIT_BEGIN_DECL 22 23 /** 24 * Create new commit in the repository from a list of `git_oid` values. 25 * 26 * See documentation for `git_commit_create()` for information about the 27 * parameters, as the meaning is identical excepting that `tree` and 28 * `parents` now take `git_oid`. This is a dangerous API in that nor 29 * the `tree`, neither the `parents` list of `git_oid`s are checked for 30 * validity. 31 * 32 * @see git_commit_create 33 */ 34 GIT_EXTERN(int) git_commit_create_from_ids( 35 git_oid *id, 36 git_repository *repo, 37 const char *update_ref, 38 const git_signature *author, 39 const git_signature *committer, 40 const char *message_encoding, 41 const char *message, 42 const git_oid *tree, 43 size_t parent_count, 44 const git_oid *parents[]); 45 46 /** 47 * Callback function to return parents for commit. 48 * 49 * This is invoked with the count of the number of parents processed so far 50 * along with the user supplied payload. This should return a git_oid of 51 * the next parent or NULL if all parents have been provided. 52 */ 53 typedef const git_oid * GIT_CALLBACK(git_commit_parent_callback)(size_t idx, void *payload); 54 55 /** 56 * Create a new commit in the repository with an callback to supply parents. 57 * 58 * See documentation for `git_commit_create()` for information about the 59 * parameters, as the meaning is identical excepting that `tree` takes a 60 * `git_oid` and doesn't check for validity, and `parent_cb` is invoked 61 * with `parent_payload` and should return `git_oid` values or NULL to 62 * indicate that all parents are accounted for. 63 * 64 * @see git_commit_create 65 */ 66 GIT_EXTERN(int) git_commit_create_from_callback( 67 git_oid *id, 68 git_repository *repo, 69 const char *update_ref, 70 const git_signature *author, 71 const git_signature *committer, 72 const char *message_encoding, 73 const char *message, 74 const git_oid *tree, 75 git_commit_parent_callback parent_cb, 76 void *parent_payload); 77 78 /** @} */ 79 GIT_END_DECL 80 #endif 81