feat(reference): add ability to create direct reference

This commit is contained in:
Aleksey Kulikov 2021-08-05 19:48:58 +03:00
parent 6643527f2d
commit 9190ed2e0f
16 changed files with 669 additions and 60 deletions

31
lib/src/odb.dart Normal file
View file

@ -0,0 +1,31 @@
import 'dart:ffi';
import 'bindings/libgit2_bindings.dart';
import 'bindings/odb.dart' as bindings;
import 'util.dart';
class Odb {
/// Initializes a new instance of [Odb] class from provided
/// pointer to Odb object in memory.
Odb(this._odbPointer) {
libgit2.git_libgit2_init();
}
/// Pointer to memory address for allocated oid object.
late final Pointer<git_odb> _odbPointer;
/// Determine if an object can be found in the object database by an abbreviated object ID.
///
/// Throws a [LibGit2Error] if error occured.
Pointer<git_oid> existsPrefix(
Pointer<git_oid> shortOid,
int len,
) {
return bindings.existsPrefix(_odbPointer, shortOid, len);
}
/// Releases memory allocated for odb object.
void free() {
bindings.free(_odbPointer);
libgit2.git_libgit2_shutdown();
}
}