mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 12:49:08 -04:00
refactor!: use class names instead of aliases from Repository in tests (#37)
BREAKING CHANGE: move API methods related to diffing into Diff class
This commit is contained in:
parent
3e1ece4e6f
commit
08cbe8a17f
28 changed files with 943 additions and 834 deletions
|
@ -178,6 +178,38 @@ class Commit {
|
|||
);
|
||||
}
|
||||
|
||||
/// Reverts commit, producing changes in the index and working directory.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void revert() {
|
||||
bindings.revert(
|
||||
repoPointer: bindings.owner(_commitPointer),
|
||||
commitPointer: _commitPointer,
|
||||
);
|
||||
}
|
||||
|
||||
/// Reverts commit against provided [commit], producing an index that
|
||||
/// reflects the result of the revert.
|
||||
///
|
||||
/// [mainline] is parent of the commit if it is a merge (i.e. 1, 2).
|
||||
///
|
||||
/// **IMPORTANT**: produced index should be freed to release allocated memory.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Index revertTo({
|
||||
required Commit commit,
|
||||
int mainline = 0,
|
||||
}) {
|
||||
return Index(
|
||||
bindings.revertCommit(
|
||||
repoPointer: bindings.owner(_commitPointer),
|
||||
revertCommitPointer: _commitPointer,
|
||||
ourCommitPointer: commit.pointer,
|
||||
mainline: mainline,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Wncoding for the message of a commit, as a string representing a standard
|
||||
/// encoding name.
|
||||
String get messageEncoding => bindings.messageEncoding(_commitPointer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue