mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(commit): add binding and API method for git_revert (#30)
This commit is contained in:
parent
fda5173e7f
commit
74a20a9cf2
3 changed files with 48 additions and 0 deletions
|
@ -361,6 +361,21 @@ Pointer<git_tree> tree(Pointer<git_commit> commit) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Reverts the given commit, producing changes in the index and working
|
||||
/// directory.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void revert({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
required Pointer<git_commit> commitPointer,
|
||||
}) {
|
||||
final error = libgit2.git_revert(repoPointer, commitPointer, nullptr);
|
||||
|
||||
if (error < 0) {
|
||||
throw LibGit2Error(libgit2.git_error_last());
|
||||
}
|
||||
}
|
||||
|
||||
/// Reverts the given commit against the given "our" commit, producing an index
|
||||
/// that reflects the result of the revert.
|
||||
///
|
||||
|
|
|
@ -665,6 +665,17 @@ class Repository {
|
|||
);
|
||||
}
|
||||
|
||||
/// Reverts the given [commit], producing changes in the index and working
|
||||
/// directory.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void revert(Commit commit) {
|
||||
commit_bindings.revert(
|
||||
repoPointer: _repoPointer,
|
||||
commitPointer: commit.pointer,
|
||||
);
|
||||
}
|
||||
|
||||
/// Finds a single object and intermediate reference (if there is one) by a
|
||||
/// [spec] revision string.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue