feat(reset): add ability to pass checkout options to reset(...) API method

This commit is contained in:
Aleksey Kulikov 2022-06-23 18:07:33 +03:00
parent 5f829dd1ca
commit 5f1831506b
3 changed files with 81 additions and 4 deletions

View file

@ -50,6 +50,30 @@ void main() {
expect(diff.deltas.length, 1);
});
test('resets with provided checkout options', () {
expect(file.readAsStringSync(), 'Feature edit\n');
repo.reset(
oid: repo[sha],
resetType: GitReset.hard,
strategy: {GitCheckout.conflictStyleZdiff3},
pathspec: ['feature_file'],
);
expect(file.readAsStringSync(), isEmpty);
});
test('throws when trying to reset and error occurs', () {
expect(
() => repo.reset(
oid: repo[sha],
resetType: GitReset.hard,
checkoutDirectory: '',
),
throwsA(isA<LibGit2Error>()),
);
});
group('resetDefault', () {
test('updates entry in the index', () {
file.writeAsStringSync('new edit');