feat(worktree): add ability to pass options to prune(...) API method

This commit is contained in:
Aleksey Kulikov 2022-06-18 11:47:53 +03:00
parent 2daadaa9a4
commit d3d93fa55c
5 changed files with 59 additions and 5 deletions

View file

@ -151,6 +151,22 @@ void main() {
expect(repo.worktrees, <String>[]);
});
test('prunes worktree with provided flags', () {
expect(repo.worktrees, <String>[]);
final worktree = Worktree.create(
repo: repo,
name: worktreeName,
path: worktreeDir.path,
);
expect(repo.worktrees, [worktreeName]);
expect(worktree.isPrunable, false);
expect(worktree.isValid, true);
worktree.prune({GitWorktree.pruneValid});
expect(repo.worktrees, <String>[]);
});
test('throws when trying get list of worktrees and error occurs', () {
expect(
() => Worktree.list(Repository(nullptr)),