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