feat(checkout): add ability to dry run checkout

This commit is contained in:
Aleksey Kulikov 2021-10-08 19:26:39 +03:00
parent 75b9ed6b57
commit 101cf90875
2 changed files with 21 additions and 0 deletions

View file

@ -1,4 +1,5 @@
import 'dart:io';
import 'package:libgit2dart/src/git_types.dart';
import 'package:test/test.dart';
import 'package:libgit2dart/libgit2dart.dart';
import 'helpers/util.dart';
@ -93,5 +94,20 @@ void main() {
},
);
});
test('successfully performs dry run checkout', () {
final index = repo.index;
expect(index.length, 4);
expect(File('${repo.workdir}/another_feature_file').existsSync(), false);
repo.checkout(
refName: 'refs/heads/feature',
strategy: {GitCheckout.dryRun},
);
expect(index.length, 4);
expect(File('${repo.workdir}/another_feature_file').existsSync(), false);
index.free();
});
});
}