feat(tag): add more bindings and api methods

This commit is contained in:
Aleksey Kulikov 2021-10-06 15:36:17 +03:00
parent 0ed5e7c797
commit c88b75b0fd
3 changed files with 72 additions and 0 deletions

View file

@ -74,6 +74,13 @@ class Tag {
return Oid(result);
}
/// Returns a list with all the tags in the repository.
///
/// Throws a [LibGit2Error] if error occured.
static List<String> list(Repository repo) {
return bindings.list(repo.pointer);
}
/// Get the tagged object (commit, tree, blob, tag) of a tag.
///
/// This method performs a repository lookup for the given object and returns it.
@ -122,6 +129,16 @@ class Tag {
}
}
/// Deletes an existing tag reference.
///
/// The tag name will be checked for validity.
///
/// Throws a [LibGit2Error] if error occured.
void delete() {
final owner = bindings.owner(_tagPointer);
bindings.delete(repoPointer: owner, tagName: name);
}
/// Releases memory allocated for tag object.
void free() => bindings.free(_tagPointer);
}