diff options
author | Vicent Marti <vicent@github.com> | 2014-03-06 00:47:05 +0100 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-03-06 00:47:05 +0100 |
commit | a064dc2d0b6206116a35be4b62c58c3c1170d5de (patch) | |
tree | ca3a9de862d9ec7042d5446a302cb8cf924618e1 /include/git2/odb.h | |
parent | a62ad3c353380fb95d0f482859b445d430018aa9 (diff) | |
parent | 26875825df19d484c24921e355963e75dc0a4476 (diff) | |
download | libgit2-a064dc2d0b6206116a35be4b62c58c3c1170d5de.tar.gz |
Merge pull request #2159 from libgit2/rb/odb-exists-prefix
Add ODB API to check for existence by prefix and object id shortener
Diffstat (limited to 'include/git2/odb.h')
-rw-r--r-- | include/git2/odb.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/git2/odb.h b/include/git2/odb.h index 82df4d300..c71e30648 100644 --- a/include/git2/odb.h +++ b/include/git2/odb.h @@ -159,6 +159,19 @@ GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_otype *type_out, git_od GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id); /** + * Determine if objects can be found in the object database from a short OID. + * + * @param out The full OID of the found object if just one is found. + * @param db The database to be searched for the given object. + * @param short_id A prefix of the id of the object to read. + * @param len The length of the prefix. + * @return 0 if found, GIT_ENOTFOUND if not found, GIT_EAMBIGUOUS if multiple + * matches were found, other value < 0 if there was a read error. + */ +GIT_EXTERN(int) git_odb_exists_prefix( + git_oid *out, git_odb *db, const git_oid *short_id, size_t len); + +/** * Refresh the object database to load newly added files. * * If the object databases have changed on disk while the library |