diff options
author | Vicent Marti <tanoku@gmail.com> | 2013-10-22 16:05:47 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2013-10-22 16:06:12 +0200 |
commit | 98fec8a937b93c6a6a0ad35ccd04af4cfeae1767 (patch) | |
tree | cfcde1a96bf914b389eb9def0dafa64621196137 /include/git2 | |
parent | 86774742a9bd3f3d4fc37ab35b2800abffeccfd8 (diff) | |
download | libgit2-98fec8a937b93c6a6a0ad35ccd04af4cfeae1767.tar.gz |
Implement `git_odb_object_dup`
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/odb.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/git2/odb.h b/include/git2/odb.h index 3bd18e782..ad56384f0 100644 --- a/include/git2/odb.h +++ b/include/git2/odb.h @@ -358,6 +358,20 @@ GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_oty GIT_EXTERN(int) git_odb_hashfile(git_oid *out, const char *path, git_otype type); /** + * Create a copy of an odb_object + * + * The returned copy must be manually freed with `git_odb_object_free`. + * Note that because of an implementation detail, the returned copy will be + * the same pointer as `source`: the object is internally refcounted, so the + * copy still needs to be freed twice. + * + * @param dest pointer where to store the copy + * @param source object to copy + * @return 0 or an error code + */ +GIT_EXTERN(int) git_odb_object_dup(git_odb_object **dest, git_odb_object *source); + +/** * Close an ODB object * * This method must always be called once a `git_odb_object` is no |