feat(odb): add more bindings and api methods

This commit is contained in:
Aleksey Kulikov 2021-10-05 17:12:51 +03:00
parent 2ce419d7c4
commit 618b4e7f05
5 changed files with 416 additions and 14 deletions

View file

@ -84,3 +84,17 @@ int compare({
}) {
return libgit2.git_oid_cmp(aPointer, bPointer);
}
/// Copy an oid from one structure to another.
///
/// Throws a [LibGit2Error] if error occured.
Pointer<git_oid> copy(Pointer<git_oid> src) {
final out = calloc<git_oid>();
final error = libgit2.git_oid_cpy(out, src);
if (error < 0) {
throw LibGit2Error(libgit2.git_error_last());
} else {
return out;
}
}