mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(reset): add ability to pass checkout options to reset(...)
API method
This commit is contained in:
parent
5f829dd1ca
commit
5f1831506b
3 changed files with 81 additions and 4 deletions
|
@ -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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue