mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(commit): add ability to revert commit
This commit is contained in:
parent
cd9f38c2bd
commit
b83fea9360
3 changed files with 72 additions and 0 deletions
|
@ -56,6 +56,21 @@ void main() {
|
|||
commit.free();
|
||||
});
|
||||
|
||||
test('successfully reverts commit', () {
|
||||
final to = repo['78b8bf123e3952c970ae5c1ce0a3ea1d1336f6e8'] as Commit;
|
||||
final from = repo['821ed6e80627b8769d170a293862f9fc60825226'] as Commit;
|
||||
final index = repo.index;
|
||||
expect(index.contains('dir/dir_file.txt'), true);
|
||||
|
||||
final revertIndex = repo.revertCommit(revertCommit: from, ourCommit: to);
|
||||
expect(revertIndex.contains('dir/dir_file.txt'), false);
|
||||
|
||||
revertIndex.free();
|
||||
index.free();
|
||||
to.free();
|
||||
from.free();
|
||||
});
|
||||
|
||||
test('successfully creates commit', () {
|
||||
final oid = Commit.create(
|
||||
repo: repo,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue