diff options
Diffstat (limited to 'include/git2/object.h')
-rw-r--r-- | include/git2/object.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/git2/object.h b/include/git2/object.h index c40631fa..9b13d824 100644 --- a/include/git2/object.h +++ b/include/git2/object.h @@ -10,6 +10,7 @@ #include "common.h" #include "types.h" #include "oid.h" +#include "buffer.h" /** * @file git2/object.h @@ -104,6 +105,20 @@ GIT_EXTERN(int) git_object_lookup_bypath( GIT_EXTERN(const git_oid *) git_object_id(const git_object *obj); /** + * Get a short abbreviated OID string for the object + * + * This starts at the "core.abbrev" length (default 7 characters) and + * iteratively extends to a longer string if that length is ambiguous. + * The result will be unambiguous (at least until new objects are added to + * the repository). + * + * @param out Buffer to write string into + * @param obj The object to get an ID for + * @return 0 on success, <0 for error + */ +GIT_EXTERN(int) git_object_short_id(git_buf *out, const git_object *obj); + +/** * Get the object type of an object * * @param obj the repository object @@ -143,7 +158,7 @@ GIT_EXTERN(git_repository *) git_object_owner(const git_object *obj); GIT_EXTERN(void) git_object_free(git_object *object); /** - * Convert an object type to it's string representation. + * Convert an object type to its string representation. * * The result is a pointer to a string in static memory and * should not be free()'ed. |