summaryrefslogtreecommitdiff
path: root/src/git/odb.h
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>2008-12-27 18:59:43 +0000
committerShawn O. Pearce <spearce@spearce.org>2008-12-30 07:52:55 -0800
commitc960d6a3f97ebd360dc3c9ea00fdb3cd5dc56224 (patch)
treed337abf625b6912fb8501993b7fb2b472d5ebcd3 /src/git/odb.h
parent007e075337848055a92e218bdfe137451a4c9635 (diff)
downloadlibgit2-c960d6a3f97ebd360dc3c9ea00fdb3cd5dc56224.tar.gz
Add a routine to determine a git_oid given an git_obj
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'src/git/odb.h')
-rw-r--r--src/git/odb.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/git/odb.h b/src/git/odb.h
index e8b17444a..0a7ee40d3 100644
--- a/src/git/odb.h
+++ b/src/git/odb.h
@@ -138,6 +138,20 @@ GIT_EXTERN(git_otype) git_obj_string_to_type(const char *str);
*/
GIT_EXTERN(int) git_obj__loose_object_type(git_otype type);
+/**
+ * Determine the object-ID (sha1 hash) of the given git_obj.
+ *
+ * The input obj must be a valid loose object type and the data
+ * pointer must not be NULL, unless the len field is also zero.
+ *
+ * @param id the resulting object-ID.
+ * @param obj the object whose hash is to be determined.
+ * @return
+ * - GIT_SUCCESS if the object-ID was correctly determined.
+ * - GIT_ERROR if the given object is malformed.
+ */
+GIT_EXTERN(int) git_obj_hash(git_oid *id, git_obj *obj);
+
/** @} */
GIT_END_DECL
#endif