summaryrefslogtreecommitdiff
path: root/include/git2/refs.h
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-08-24 21:30:45 +0200
committernulltoken <emeric.fermas@gmail.com>2012-09-06 18:40:05 +0200
commit316659489a97e8e93f88dd3610320c8ae5b35e4a (patch)
tree5ce94fb5fd89474f95a889708224c64f32b41701 /include/git2/refs.h
parent0e9f2fcef6955a9c15f216ad78eec538cc97a8f3 (diff)
downloadlibgit2-316659489a97e8e93f88dd3610320c8ae5b35e4a.tar.gz
refs: introduce git_reference_peel()
Fix #530
Diffstat (limited to 'include/git2/refs.h')
-rw-r--r--include/git2/refs.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/git2/refs.h b/include/git2/refs.h
index 660b48b5f..73b32a9e2 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -434,6 +434,26 @@ GIT_EXTERN(int) git_reference_normalize_name(
const char *name,
unsigned int flags);
+/**
+ * Recursively peel an reference until an object of the
+ * specified type is met.
+ *
+ * The retrieved `peeled` object is owned by the repository
+ * and should be closed with the `git_object_free` method.
+ *
+ * If you pass `GIT_OBJ_ANY` as the target type, then the object
+ * will be peeled until a non-tag object is met.
+ *
+ * @param peeled Pointer to the peeled git_object
+ * @param ref The reference to be processed
+ * @param target_type The type of the requested object
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_reference_peel(
+ git_object **out,
+ git_reference *ref,
+ git_otype type);
+
/** @} */
GIT_END_DECL
#endif