feat(reflog): add more bindings and API methods (#29)

This commit is contained in:
Aleksey Kulikov 2021-12-23 10:58:44 +03:00 committed by GitHub
parent ff2dd8b408
commit fda5173e7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 305 additions and 12 deletions

View file

@ -139,6 +139,19 @@ class Reference {
refdb_bindings.free(refdb);
}
/// Ensures there is a reflog for a particular reference.
///
/// Makes sure that successive updates to the reference will append to its
/// log.
///
/// Throws a [LibGit2Error] if error occured.
static void ensureLog({
required Repository repo,
required String refName,
}) {
bindings.ensureLog(repoPointer: repo.pointer, refName: refName);
}
/// Creates a copy of an existing reference.
///
/// **IMPORTANT**: Should be freed to release allocated memory.
@ -247,17 +260,6 @@ class Reference {
);
}
/// Ensures there is a reflog for a particular reference.
///
/// Makes sure that successive updates to the reference will append to its
/// log.
///
/// Throws a [LibGit2Error] if error occured.
void ensureLog() {
final owner = bindings.owner(_refPointer);
bindings.ensureLog(repoPointer: owner, refName: name);
}
/// [RefLog] object.
///
/// **IMPORTANT**: Should be freed to release allocated memory.