feat(reset): add binding and api method for git_reset_default

This commit is contained in:
Aleksey Kulikov 2021-12-04 16:02:15 +03:00
parent 33d2750d38
commit bfe2d118b2
3 changed files with 89 additions and 0 deletions

View file

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