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 /**
8  * License: GPL-2.0(Linking Exception)
9  */
10 module libgit2.sys.commit;
11 
12 
13 private static import libgit2.oid;
14 private static import libgit2.types;
15 private import libgit2.common: GIT_EXTERN;
16 
17 /*
18  * @file git2/sys/commit.h
19  * @brief Low-level Git commit creation
20  * @defgroup git_backend Git custom backend APIs
21  * @ingroup Git
22  * @{
23  */
24 extern (C):
25 nothrow @nogc:
26 
27 /**
28  * Create new commit in the repository from a list of `git_oid` values.
29  *
30  * See documentation for `git_commit_create()` for information about the
31  * parameters, as the meaning is identical excepting that `tree` and
32  * `parents` now take `git_oid`.  This is a dangerous API in that nor
33  * the `tree`, neither the `parents` list of `git_oid`s are checked for
34  * validity.
35  *
36  * @see git_commit_create
37  */
38 @GIT_EXTERN
39 int git_commit_create_from_ids(libgit2.oid.git_oid* id, libgit2.types.git_repository* repo, const (char)* update_ref, const (libgit2.types.git_signature)* author, const (libgit2.types.git_signature)* committer, const (char)* message_encoding, const (char)* message, const (libgit2.oid.git_oid)* tree, size_t parent_count, const (libgit2.oid.git_oid)** parents);
40 
41 /**
42  * Callback function to return parents for commit.
43  *
44  * This is invoked with the count of the number of parents processed so far
45  * along with the user supplied payload.  This should return a git_oid of
46  * the next parent or null if all parents have been provided.
47  */
48 alias git_commit_parent_callback = const (libgit2.oid.git_oid)* function(size_t idx, void* payload);
49 
50 /**
51  * Create a new commit in the repository with an callback to supply parents.
52  *
53  * See documentation for `git_commit_create()` for information about the
54  * parameters, as the meaning is identical excepting that `tree` takes a
55  * `git_oid` and doesn't check for validity, and `parent_cb` is invoked
56  * with `parent_payload` and should return `git_oid` values or null to
57  * indicate that all parents are accounted for.
58  *
59  * @see git_commit_create
60  */
61 @GIT_EXTERN
62 int git_commit_create_from_callback(libgit2.oid.git_oid* id, libgit2.types.git_repository* repo, const (char)* update_ref, const (libgit2.types.git_signature)* author, const (libgit2.types.git_signature)* committer, const (char)* message_encoding, const (char)* message, const (libgit2.oid.git_oid)* tree, .git_commit_parent_callback parent_cb, void* parent_payload);
63 
64 /* @} */