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:
Aleksey Kulikov 2022-01-25 12:05:34 +03:00 committed by GitHub
parent 3e1ece4e6f
commit 08cbe8a17f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 943 additions and 834 deletions

View file

@ -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);