summaryrefslogtreecommitdiff
path: root/include/git2/revparse.h
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2013-05-09 16:42:39 +0200
committernulltoken <emeric.fermas@gmail.com>2013-05-16 21:43:24 +0200
commite841c533d75c12156e0be8811d02f0537e32a458 (patch)
treec3bbeac67ce1e70a96ec2173a4e722720539d0e1 /include/git2/revparse.h
parentdcaa898d8200d5eefa5ba8c7618c5526d8392da0 (diff)
downloadlibgit2-e841c533d75c12156e0be8811d02f0537e32a458.tar.gz
revparse: Introduce git_revparse_ext()
Expose a way to retrieve, along with the target git_object, the reference pointed at by some revparse expression (`@{<-n>}` or `<branchname>@{upstream}` syntax).
Diffstat (limited to 'include/git2/revparse.h')
-rw-r--r--include/git2/revparse.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/git2/revparse.h b/include/git2/revparse.h
index e155c7012..786a9da57 100644
--- a/include/git2/revparse.h
+++ b/include/git2/revparse.h
@@ -32,6 +32,28 @@ GIT_BEGIN_DECL
*/
GIT_EXTERN(int) git_revparse_single(git_object **out, git_repository *repo, const char *spec);
+/**
+ * Find a single object, as specified by a revision string.
+ * See `man gitrevisions`,
+ * or http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for
+ * information on the syntax accepted.
+ *
+ * In some cases (`@{<-n>}` or `<branchname>@{upstream}`), the expression may
+ * point to an intermediate reference. When such expressions are being passed
+ * in, `reference_out` will be valued as well.
+ *
+ * @param object_out pointer to output object
+ * @param reference_out pointer to output reference or NULL
+ * @param repo the repository to search in
+ * @param spec the textual specification for an object
+ * @return 0 on success, GIT_ENOTFOUND, GIT_EAMBIGUOUS, GIT_EINVALIDSPEC
+ * or an error code
+ */
+GIT_EXTERN(int) git_revparse_ext(
+ git_object **object_out,
+ git_reference **reference_out,
+ git_repository *repo,
+ const char *spec);
/**
* Revparse flags. These indicate the intended behavior of the spec passed to