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