mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(worktree): add ability to pass options to prune(...)
API method (#71)
This commit is contained in:
parent
2daadaa9a4
commit
5f829dd1ca
5 changed files with 59 additions and 5 deletions
|
@ -562,4 +562,14 @@ void main() {
|
|||
final actual = {for (final e in GitIndexAddOption.values) e: e.value};
|
||||
expect(actual, expected);
|
||||
});
|
||||
|
||||
test('GitWorktree returns correct values', () {
|
||||
const expected = {
|
||||
GitWorktree.pruneValid: 1,
|
||||
GitWorktree.pruneLocked: 2,
|
||||
GitWorktree.pruneWorkingTree: 4,
|
||||
};
|
||||
final actual = {for (final e in GitWorktree.values) e: e.value};
|
||||
expect(actual, expected);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue