feat(reference): add ability to compress references

This commit is contained in:
Aleksey Kulikov 2021-09-04 15:27:09 +03:00
parent f63808b4f8
commit 28c4eca573
4 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,20 @@
import 'dart:ffi';
import '../error.dart';
import 'libgit2_bindings.dart';
import '../util.dart';
/// Suggests that the given refdb compress or optimize its references.
/// This mechanism is implementation specific. For on-disk reference databases,
/// for example, this may pack all loose references.
///
/// Throws a [LibGit2Error] if error occured.
void compress(Pointer<git_refdb> refdb) {
final error = libgit2.git_refdb_compress(refdb);
if (error < 0) {
throw LibGit2Error(libgit2.git_error_last());
}
}
/// Close an open reference database to release memory.
void free(Pointer<git_refdb> refdb) => libgit2.git_refdb_free(refdb);