mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(reset): add binding and api method for git_reset_default (#14)
This commit is contained in:
parent
33d2750d38
commit
2009c76b50
3 changed files with 89 additions and 0 deletions
|
@ -61,5 +61,32 @@ void main() {
|
|||
|
||||
index.free();
|
||||
});
|
||||
|
||||
group('resetDefault', () {
|
||||
test('successfully updates entry in the index', () {
|
||||
file.writeAsStringSync('new edit');
|
||||
|
||||
final index = repo.index;
|
||||
index.add('feature_file');
|
||||
expect(repo.status['feature_file'], {GitStatus.indexModified});
|
||||
|
||||
final head = repo.head;
|
||||
repo.resetDefault(oid: head.target, pathspec: ['feature_file']);
|
||||
expect(repo.status['feature_file'], {GitStatus.wtModified});
|
||||
|
||||
head.free();
|
||||
index.free();
|
||||
});
|
||||
|
||||
test('throws when pathspec list is empty', () {
|
||||
final head = repo.head;
|
||||
expect(
|
||||
() => repo.resetDefault(oid: head.target, pathspec: []),
|
||||
throwsA(isA<LibGit2Error>()),
|
||||
);
|
||||
|
||||
head.free();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue