summaryrefslogtreecommitdiff
path: root/include/git2/annotated_commit.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-03-07 00:06:02 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-16 16:57:30 +0100
commit62dd4d71db1408ae03ca7d4d4d2c48f7874a41d9 (patch)
tree93bcef330efb90f7186183d9f92e22626f041831 /include/git2/annotated_commit.h
parent62d38a1ddb8081f8b46e7ff6e21ebeb0014162d6 (diff)
downloadlibgit2-62dd4d71db1408ae03ca7d4d4d2c48f7874a41d9.tar.gz
annotated_commit: provide a constructor from a revspec
This extra constructor will be useful for the annotated versions of ref-modifying functions, as it allows us to create a commit with the extended sha syntax which was used to retrieve it.
Diffstat (limited to 'include/git2/annotated_commit.h')
-rw-r--r--include/git2/annotated_commit.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/git2/annotated_commit.h b/include/git2/annotated_commit.h
index e842d2032..7fb896a5f 100644
--- a/include/git2/annotated_commit.h
+++ b/include/git2/annotated_commit.h
@@ -78,6 +78,23 @@ GIT_EXTERN(int) git_annotated_commit_lookup(
const git_oid *id);
/**
+ * Creates a `git_annotated_comit` from a revision string.
+ *
+ * See `man gitrevisions`, or
+ * http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for
+ * information on the syntax accepted.
+ *
+ * @param out pointer to store the git_annotated_commit result in
+ * @param repo repository that contains the given commit
+ * @param revspec the extended sha syntax string to use to lookup the commit
+ * @return 0 on success or error code
+ */
+GIT_EXTERN(int) git_annotated_commit_from_revspec(
+ git_annotated_commit **out,
+ git_repository *repo,
+ const char *revspec);
+
+/**
* Gets the commit ID that the given `git_annotated_commit` refers to.
*
* @param commit the given annotated commit