mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
refactor!: use Finalizer
to automatically free allocated memory for objects (#48)
BREAKING CHANGE: signature change for remote and repository callbacks during repository clone operation.
This commit is contained in:
parent
94c40f9a94
commit
a3213a88a2
103 changed files with 2278 additions and 2595 deletions
|
@ -30,7 +30,6 @@ void main() {
|
|||
});
|
||||
|
||||
tearDown(() {
|
||||
remote.free();
|
||||
originRepo.free();
|
||||
clonedRepo.free();
|
||||
tmpDir.deleteSync(recursive: true);
|
||||
|
@ -41,35 +40,26 @@ void main() {
|
|||
group('Remote', () {
|
||||
test('fetch() does not prune branch by default', () {
|
||||
remote.fetch();
|
||||
|
||||
final branches = clonedRepo.branches;
|
||||
expect(branches.any((branch) => branch.name == 'origin/feature'), true);
|
||||
|
||||
for (final branch in branches) {
|
||||
branch.free();
|
||||
}
|
||||
expect(
|
||||
clonedRepo.branches.any((branch) => branch.name == 'origin/feature'),
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('fetch() prunes branch with provided flag', () {
|
||||
remote.fetch(prune: GitFetchPrune.prune);
|
||||
|
||||
final branches = clonedRepo.branches;
|
||||
expect(branches.any((branch) => branch.name == 'origin/feature'), false);
|
||||
|
||||
for (final branch in branches) {
|
||||
branch.free();
|
||||
}
|
||||
expect(
|
||||
clonedRepo.branches.any((branch) => branch.name == 'origin/feature'),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
test('fetch() does not prune branch with provided flag', () {
|
||||
remote.fetch(prune: GitFetchPrune.noPrune);
|
||||
|
||||
final branches = clonedRepo.branches;
|
||||
expect(branches.any((branch) => branch.name == 'origin/feature'), true);
|
||||
|
||||
for (final branch in branches) {
|
||||
branch.free();
|
||||
}
|
||||
expect(
|
||||
clonedRepo.branches.any((branch) => branch.name == 'origin/feature'),
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('prune() prunes branches', () {
|
||||
|
@ -81,22 +71,18 @@ void main() {
|
|||
final callbacks = Callbacks(updateTips: updateTips);
|
||||
|
||||
remote.fetch(prune: GitFetchPrune.noPrune);
|
||||
var branches = clonedRepo.branches;
|
||||
expect(branches.any((branch) => branch.name == 'origin/feature'), true);
|
||||
|
||||
for (final branch in branches) {
|
||||
branch.free();
|
||||
}
|
||||
expect(
|
||||
clonedRepo.branches.any((branch) => branch.name == 'origin/feature'),
|
||||
true,
|
||||
);
|
||||
|
||||
remote.prune(callbacks);
|
||||
|
||||
branches = clonedRepo.branches;
|
||||
expect(pruned, contains('refs/remotes/origin/feature'));
|
||||
expect(branches.any((branch) => branch.name == 'origin/feature'), false);
|
||||
|
||||
for (final branch in branches) {
|
||||
branch.free();
|
||||
}
|
||||
expect(
|
||||
clonedRepo.branches.any((branch) => branch.name == 'origin/feature'),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue