diff options
author | Russell Belfer <rb@github.com> | 2014-03-04 16:23:28 -0800 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-03-04 16:23:28 -0800 |
commit | 13f7ecd7b9c5244441eeaae798c8657d1818ea7f (patch) | |
tree | dad7f25d5b6a5c2c7cf41ea32e5914fe181b95ce /include/git2/object.h | |
parent | f5753999e4cac020c2dd3a4669fe9ba14df93cb5 (diff) | |
download | libgit2-13f7ecd7b9c5244441eeaae798c8657d1818ea7f.tar.gz |
Add git_object_short_id API to get short id string
This finds a short id string that will unambiguously select the
given object, starting with the core.abbrev length (usually 7)
and growing until it is no longer ambiguous.
Diffstat (limited to 'include/git2/object.h')
-rw-r--r-- | include/git2/object.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/git2/object.h b/include/git2/object.h index c40631fa6..416feffbc 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,15 @@ 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 + * + * @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 |