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 module libgit2_d.annotated_commit;
8 
9 
10 private static import libgit2_d.oid;
11 private static import libgit2_d.types;
12 
13 /**
14  * @file git2/annotated_commit.h
15  * @brief Git annotated commit routines
16  * @defgroup git_annotated_commit Git annotated commit routines
17  * @ingroup Git
18  * @{
19  */
20 extern (C):
21 nothrow @nogc:
22 public:
23 
24 /**
25  * Creates a `git_annotated_commit` from a revision string.
26  * The resulting git_annotated_commit must be freed with
27  * `git_annotated_commit_free`.
28  *
29  * Params:
30  *      out_ = pointer to store the git_annotated_commit result in
31  *      repo = repository that contains the given reference
32  *      ref_ = reference to use to lookup the git_annotated_commit
33  *
34  * Returns: 0 on success or error code
35  */
36 //GIT_EXTERN
37 int git_annotated_commit_from_ref(libgit2_d.types.git_annotated_commit** out_, libgit2_d.types.git_repository* repo, const (libgit2_d.types.git_reference)* ref_);
38 
39 /**
40  * Creates a `git_annotated_commit` from the given fetch head data.
41  * The resulting git_annotated_commit must be freed with
42  * `git_annotated_commit_free`.
43  *
44  * Params:
45  *      out_ = pointer to store the git_annotated_commit result in
46  *      repo = repository that contains the given commit
47  *      branch_name = name of the (remote) branch
48  *      remote_url = url of the remote
49  *      id = the commit object id of the remote branch
50  *
51  * Returns: 0 on success or error code
52  */
53 //GIT_EXTERN
54 int git_annotated_commit_from_fetchhead(libgit2_d.types.git_annotated_commit** out_, libgit2_d.types.git_repository* repo, const (char)* branch_name, const (char)* remote_url, const (libgit2_d.oid.git_oid)* id);
55 
56 /**
57  * Creates a `git_annotated_commit` from the given commit id.
58  * The resulting git_annotated_commit must be freed with
59  * `git_annotated_commit_free`.
60  *
61  * An annotated commit contains information about how it was
62  * looked up, which may be useful for functions like merge or
63  * rebase to provide context to the operation.  For example,
64  * conflict files will include the name of the source or target
65  * branches being merged.  It is therefore preferable to use the
66  * most specific function (eg `git_annotated_commit_from_ref`)
67  * instead of this one when that data is known.
68  *
69  * Params:
70  *      out_ = pointer to store the git_annotated_commit result in
71  *      repo = repository that contains the given commit
72  *      id = the commit object id to lookup
73  *
74  * Returns: 0 on success or error code
75  */
76 //GIT_EXTERN
77 int git_annotated_commit_lookup(libgit2_d.types.git_annotated_commit** out_, libgit2_d.types.git_repository* repo, const (libgit2_d.oid.git_oid)* id);
78 
79 /**
80  * Creates a `git_annotated_comit` from a revision string.
81  *
82  * See `man gitrevisions`, or
83  * http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for
84  * information on the syntax accepted.
85  *
86  * Params:
87  *      out_ = pointer to store the git_annotated_commit result in
88  *      repo = repository that contains the given commit
89  *      revspec = the extended sha syntax string to use to lookup the commit
90  *
91  * Returns: 0 on success or error code
92  */
93 //GIT_EXTERN
94 int git_annotated_commit_from_revspec(libgit2_d.types.git_annotated_commit** out_, libgit2_d.types.git_repository* repo, const (char)* revspec);
95 
96 /**
97  * Gets the commit ID that the given `git_annotated_commit` refers to.
98  *
99  * Params:
100  *      commit = the given annotated commit
101  *
102  * Returns: commit id
103  */
104 //GIT_EXTERN
105 const (libgit2_d.oid.git_oid)* git_annotated_commit_id(const (libgit2_d.types.git_annotated_commit)* commit);
106 
107 /**
108  * Get the refname that the given `git_annotated_commit` refers to.
109  *
110  * Params:
111  *      commit = the given annotated commit
112  *
113  * Returns: ref name.
114  */
115 //GIT_EXTERN
116 const (char)* git_annotated_commit_ref(const (libgit2_d.types.git_annotated_commit)* commit);
117 
118 /**
119  * Frees a `git_annotated_commit`.
120  *
121  * Params:
122  *      commit = annotated commit to free
123  */
124 //GIT_EXTERN
125 void git_annotated_commit_free(libgit2_d.types.git_annotated_commit* commit);
126 
127 /** @} */