diff --git a/lib/src/annotated.dart b/lib/src/annotated.dart index 0c4669e..c500dd9 100644 --- a/lib/src/annotated.dart +++ b/lib/src/annotated.dart @@ -84,7 +84,6 @@ class AnnotatedCommit extends Equatable { /// Pointer to pointer to memory address for allocated commit object. /// /// Note: For internal use. - @internal Pointer get pointer => _annotatedCommitPointer; /// Commit oid that the given annotated commit refers to. diff --git a/lib/src/bindings/worktree.dart b/lib/src/bindings/worktree.dart index 61923da..663c1f2 100644 --- a/lib/src/bindings/worktree.dart +++ b/lib/src/bindings/worktree.dart @@ -96,16 +96,8 @@ bool isPrunable(Pointer wt) { /// Prune working tree. /// /// Prune the working tree, that is remove the git data structures on disk. -void prune({required Pointer worktreePointer, int? flags}) { - final opts = calloc(); - libgit2.git_worktree_prune_options_init( - opts, - GIT_WORKTREE_PRUNE_OPTIONS_VERSION, - ); - - if (flags != null) opts.ref.flags = flags; - - libgit2.git_worktree_prune(worktreePointer, opts); +void prune(Pointer wt) { + libgit2.git_worktree_prune(wt, nullptr); } /// List names of linked working trees. diff --git a/lib/src/blob.dart b/lib/src/blob.dart index 5b27d78..89ea241 100644 --- a/lib/src/blob.dart +++ b/lib/src/blob.dart @@ -12,7 +12,6 @@ class Blob extends Equatable { /// blob object in memory. /// /// Note: For internal use. Use [Blob.lookup] instead. - @internal Blob(this._blobPointer) { _finalizer.attach(this, _blobPointer, detach: this); } @@ -31,7 +30,6 @@ class Blob extends Equatable { /// Pointer to memory address for allocated blob object. /// /// Note: For internal use. - @internal Pointer get pointer => _blobPointer; /// Creates a new blob from a [content] string and writes it to ODB. diff --git a/lib/src/branch.dart b/lib/src/branch.dart index c221105..976598c 100644 --- a/lib/src/branch.dart +++ b/lib/src/branch.dart @@ -15,7 +15,6 @@ class Branch extends Equatable { /// Note: For internal use. Instead, use one of: /// - [Branch.create] /// - [Branch.lookup] - @internal Branch(this._branchPointer) { _finalizer.attach(this, _branchPointer, detach: this); } @@ -75,7 +74,6 @@ class Branch extends Equatable { /// Pointer to memory address for allocated branch object. /// /// Note: For internal use. - @internal Pointer get pointer => _branchPointer; /// Returns a list of branches that can be found in a [repo]sitory for diff --git a/lib/src/commit.dart b/lib/src/commit.dart index 3cd7ef1..0e399ff 100644 --- a/lib/src/commit.dart +++ b/lib/src/commit.dart @@ -13,7 +13,6 @@ class Commit extends Equatable { /// commit object in memory. /// /// Note: For internal use. Use [Commit.lookup] instead. - @internal Commit(this._commitPointer) { _finalizer.attach(this, _commitPointer, detach: this); } @@ -32,7 +31,6 @@ class Commit extends Equatable { /// Pointer to memory address for allocated commit object. /// /// Note: For internal use. - @internal Pointer get pointer => _commitPointer; /// Creates new commit in the [repo]sitory. diff --git a/lib/src/config.dart b/lib/src/config.dart index 5d236de..7ccce28 100644 --- a/lib/src/config.dart +++ b/lib/src/config.dart @@ -20,7 +20,6 @@ class Config with IterableMixin { /// - [Config.system] /// - [Config.global] /// - [Config.xdg] - @internal Config(this._configPointer) { _finalizer.attach(this, _configPointer, detach: this); } diff --git a/lib/src/diff.dart b/lib/src/diff.dart index 3425ce2..9ca2605 100644 --- a/lib/src/diff.dart +++ b/lib/src/diff.dart @@ -21,7 +21,6 @@ class Diff extends Equatable { /// - [Diff.treeToWorkdirWithIndex] /// - [Diff.treeToTree] /// - [Diff.parse] - @internal Diff(this._diffPointer) { _finalizer.attach(this, _diffPointer, detach: this); } @@ -277,7 +276,6 @@ class Diff extends Equatable { /// Pointer to memory address for allocated diff object. /// /// Note: For internal use. - @internal Pointer get pointer => _diffPointer; /// How many diff records are there in a diff. @@ -473,9 +471,6 @@ final _finalizer = Finalizer>( class DiffDelta extends Equatable { /// Initializes a new instance of [DiffDelta] class from provided /// pointer to diff delta object in memory. - /// - /// Note: For internal use. - @internal const DiffDelta(this._diffDeltaPointer); /// Pointer to memory address for allocated diff delta object. @@ -583,7 +578,6 @@ class DiffStats { /// pointer to diff stats object in memory. /// /// Note: For internal use. - @internal DiffStats(this._diffStatsPointer) { _statsFinalizer.attach(this, _diffStatsPointer, detach: this); } diff --git a/lib/src/error.dart b/lib/src/error.dart index 5a52968..97eec9b 100644 --- a/lib/src/error.dart +++ b/lib/src/error.dart @@ -3,12 +3,9 @@ import 'dart:ffi'; import 'package:libgit2dart/src/bindings/libgit2_bindings.dart'; import 'package:libgit2dart/src/extensions.dart'; -import 'package:meta/meta.dart'; /// Details of the last error that occurred. class LibGit2Error { - /// Note: For internal use. - @internal LibGit2Error(this._errorPointer); final Pointer _errorPointer; diff --git a/lib/src/git_types.dart b/lib/src/git_types.dart index 3659324..65be8ed 100644 --- a/lib/src/git_types.dart +++ b/lib/src/git_types.dart @@ -1192,18 +1192,3 @@ enum GitIndexAddOption { const GitIndexAddOption(this.value); final int value; } - -/// Flags to alter working tree pruning behavior. -enum GitWorktree { - /// Prune working tree even if working tree is valid. - pruneValid(1), - - /// Prune working tree even if it is locked. - pruneLocked(2), - - /// Prune checked out working tree. - pruneWorkingTree(4); - - const GitWorktree(this.value); - final int value; -} diff --git a/lib/src/index.dart b/lib/src/index.dart index 63ab0be..96ff8f8 100644 --- a/lib/src/index.dart +++ b/lib/src/index.dart @@ -13,7 +13,6 @@ class Index with IterableMixin { /// pointer to index object in memory. /// /// Note: For internal use. - @internal Index(this._indexPointer) { _finalizer.attach(this, _indexPointer, detach: this); } @@ -32,7 +31,6 @@ class Index with IterableMixin { /// Pointer to memory address for allocated index object. /// /// Note: For internal use. - @internal Pointer get pointer => _indexPointer; /// Full path to the index file on disk. @@ -341,7 +339,6 @@ class IndexEntry extends Equatable { /// Initializes a new instance of [IndexEntry] class. /// /// Note: For internal use. - @internal const IndexEntry(this._indexEntryPointer); final Pointer _indexEntryPointer; @@ -349,7 +346,6 @@ class IndexEntry extends Equatable { /// Pointer to memory address for allocated index entry object. /// /// Note: For internal use. - @internal Pointer get pointer => _indexEntryPointer; /// [Oid] of the index entry. @@ -391,7 +387,6 @@ class ConflictEntry { /// Initializes a new instance of [ConflictEntry] class. /// /// Note: For internal use. - @internal const ConflictEntry( this._indexPointer, this._path, diff --git a/lib/src/note.dart b/lib/src/note.dart index f29aac0..1dd874b 100644 --- a/lib/src/note.dart +++ b/lib/src/note.dart @@ -11,7 +11,6 @@ class Note extends Equatable { /// pointer to note and annotatedOid objects in memory. /// /// Note: For internal use. Use [Note.lookup] instead. - @internal Note(this._notePointer, this._annotatedOidPointer) { _finalizer.attach(this, _notePointer, detach: this); } diff --git a/lib/src/odb.dart b/lib/src/odb.dart index a3c486f..0969f2f 100644 --- a/lib/src/odb.dart +++ b/lib/src/odb.dart @@ -12,7 +12,6 @@ class Odb extends Equatable { /// pointer to Odb object in memory. /// /// Note: For internal use. - @internal Odb(this._odbPointer) { _finalizer.attach(this, _odbPointer, detach: this); } @@ -33,7 +32,6 @@ class Odb extends Equatable { /// Pointer to memory address for allocated oid object. /// /// Note: For internal use. - @internal Pointer get pointer => _odbPointer; /// Adds an on-disk alternate to an existing Object DB. diff --git a/lib/src/oid.dart b/lib/src/oid.dart index 0e50b1b..ceca4b1 100644 --- a/lib/src/oid.dart +++ b/lib/src/oid.dart @@ -14,7 +14,6 @@ class Oid extends Equatable { /// pointer to Oid object in memory. /// /// Note: For internal use. Use [Oid.fromSHA] instead. - @internal Oid(this._oidPointer); /// Initializes a new instance of [Oid] class by determining if an object can @@ -42,9 +41,6 @@ class Oid extends Equatable { /// Initializes a new instance of [Oid] class from provided raw git_oid /// structure. - /// - /// Note: For internal use. - @internal Oid.fromRaw(git_oid raw) { _oidPointer = bindings.fromRaw(raw.id); } @@ -54,7 +50,6 @@ class Oid extends Equatable { /// Pointer to memory address for allocated oid object. /// /// Note: For internal use. - @internal Pointer get pointer => _oidPointer; /// Hexadecimal SHA string. diff --git a/lib/src/packbuilder.dart b/lib/src/packbuilder.dart index c9a9ea6..f151b07 100644 --- a/lib/src/packbuilder.dart +++ b/lib/src/packbuilder.dart @@ -2,7 +2,6 @@ import 'dart:ffi'; import 'package:libgit2dart/libgit2dart.dart'; import 'package:libgit2dart/src/bindings/libgit2_bindings.dart'; import 'package:libgit2dart/src/bindings/packbuilder.dart' as bindings; -import 'package:meta/meta.dart'; class PackBuilder { /// Initializes a new instance of [PackBuilder] class. @@ -10,7 +9,6 @@ class PackBuilder { /// Throws a [LibGit2Error] if error occured. /// /// Note: For internal use. - @internal PackBuilder(Repository repo) { _packbuilderPointer = bindings.init(repo.pointer); _finalizer.attach(this, _packbuilderPointer, detach: this); diff --git a/lib/src/patch.dart b/lib/src/patch.dart index c837afa..16e5b25 100644 --- a/lib/src/patch.dart +++ b/lib/src/patch.dart @@ -18,7 +18,6 @@ class Patch extends Equatable { /// - [Patch.fromBlobAndBuffer] /// - [Patch.fromBuffers] /// - [Patch.fromDiff] - @internal Patch(this._patchPointer) { _finalizer.attach(this, _patchPointer, detach: this); } diff --git a/lib/src/reference.dart b/lib/src/reference.dart index c5d4471..1f45270 100644 --- a/lib/src/reference.dart +++ b/lib/src/reference.dart @@ -17,7 +17,6 @@ class Reference extends Equatable { /// Note: For internal use. Instead, use one of: /// - [Reference.create] /// - [Reference.lookup] - @internal Reference(this._refPointer) { _finalizer.attach(this, _refPointer, detach: this); } @@ -88,7 +87,6 @@ class Reference extends Equatable { /// Pointer to memory address for allocated reference object. /// /// Note: For internal use. - @internal Pointer get pointer => _refPointer; /// Deletes an existing reference with provided [name]. diff --git a/lib/src/refspec.dart b/lib/src/refspec.dart index 66c9405..679abca 100644 --- a/lib/src/refspec.dart +++ b/lib/src/refspec.dart @@ -11,7 +11,6 @@ class Refspec extends Equatable { /// from provided pointer to refspec object in memory. /// /// Note: For internal use. - @internal const Refspec(this._refspecPointer); /// Pointer to memory address for allocated refspec object. diff --git a/lib/src/remote.dart b/lib/src/remote.dart index d74dbf3..9144861 100644 --- a/lib/src/remote.dart +++ b/lib/src/remote.dart @@ -327,7 +327,6 @@ class TransferProgress { /// pointer to transfer progress object in memory. /// /// Note: For internal use. - @internal const TransferProgress(this._transferProgressPointer); /// Pointer to memory address for allocated transfer progress object. diff --git a/lib/src/repository.dart b/lib/src/repository.dart index 619b1ea..2cc9f04 100644 --- a/lib/src/repository.dart +++ b/lib/src/repository.dart @@ -23,7 +23,6 @@ class Repository extends Equatable { /// - [Repository.init] /// - [Repository.open] /// - [Repository.clone] - @internal Repository(Pointer pointer) { _repoPointer = pointer; _finalizer.attach(this, _repoPointer, detach: this); @@ -162,7 +161,6 @@ class Repository extends Equatable { /// Pointer to memory address for allocated repository object. /// /// Note: For internal use. - @internal Pointer get pointer => _repoPointer; /// Looks for a git repository and return its path. The lookup start from diff --git a/lib/src/revwalk.dart b/lib/src/revwalk.dart index 78b8491..610ebb9 100644 --- a/lib/src/revwalk.dart +++ b/lib/src/revwalk.dart @@ -2,7 +2,6 @@ import 'dart:ffi'; import 'package:libgit2dart/libgit2dart.dart'; import 'package:libgit2dart/src/bindings/libgit2_bindings.dart'; import 'package:libgit2dart/src/bindings/revwalk.dart' as bindings; -import 'package:meta/meta.dart'; class RevWalk { /// Initializes a new instance of the [RevWalk] class. @@ -16,7 +15,6 @@ class RevWalk { /// Pointer to memory address for allocated [RevWalk] object. /// /// Note: For internal use. - @internal Pointer get pointer => _revWalkPointer; /// Returns the list of commits from the revision walk. diff --git a/lib/src/signature.dart b/lib/src/signature.dart index 620b33c..c533191 100644 --- a/lib/src/signature.dart +++ b/lib/src/signature.dart @@ -16,7 +16,6 @@ class Signature extends Equatable { /// Note: For internal use. Instead, use one of: /// - [Signature.create] /// - [Signature.defaultSignature] - @internal Signature(Pointer pointer) { _signaturePointer = bindings.duplicate(pointer); _finalizer.attach(this, _signaturePointer, detach: this); @@ -63,7 +62,6 @@ class Signature extends Equatable { /// Pointer to memory address for allocated signature object. /// /// Note: For internal use. - @internal Pointer get pointer => _signaturePointer; /// Full name of the author. diff --git a/lib/src/stash.dart b/lib/src/stash.dart index bbd1267..85f5ff2 100644 --- a/lib/src/stash.dart +++ b/lib/src/stash.dart @@ -7,9 +7,6 @@ import 'package:meta/meta.dart'; class Stash extends Equatable { /// Initializes a new instance of [Stash] class from provided stash [index], /// [message] and [oid]. - /// - /// Note: For internal use. Use [Stash.create] instead to create stash. - @internal const Stash({ required this.index, required this.message, diff --git a/lib/src/tag.dart b/lib/src/tag.dart index 14965e8..8a9e26a 100644 --- a/lib/src/tag.dart +++ b/lib/src/tag.dart @@ -13,7 +13,6 @@ class Tag extends Equatable { /// tag object in memory. /// /// Note: For internal use. Use [Tag.lookup] instead. - @internal Tag(this._tagPointer) { _finalizer.attach(this, _tagPointer, detach: this); } diff --git a/lib/src/tree.dart b/lib/src/tree.dart index d3a479a..5ab1a73 100644 --- a/lib/src/tree.dart +++ b/lib/src/tree.dart @@ -12,7 +12,6 @@ class Tree extends Equatable { /// tree object in memory. /// /// Note: For internal use. Use [Tree.lookup] instead. - @internal Tree(this._treePointer) { _finalizer.attach(this, _treePointer, detach: this); } @@ -31,7 +30,6 @@ class Tree extends Equatable { /// Pointer to memory address for allocated tree object. /// /// Note: For internal use. - @internal Pointer get pointer => _treePointer; /// List with tree entries of a tree. @@ -115,7 +113,6 @@ class TreeEntry extends Equatable { /// tree entry object in memory. /// /// Note: For internal use. - @internal const TreeEntry(this._treeEntryPointer); /// Initializes a new instance of [TreeEntry] class from provided pointer to diff --git a/lib/src/worktree.dart b/lib/src/worktree.dart index d78e7cc..32939c6 100644 --- a/lib/src/worktree.dart +++ b/lib/src/worktree.dart @@ -77,15 +77,10 @@ class Worktree extends Equatable { /// Throws a [LibGit2Error] if error occured. bool get isPrunable => bindings.isPrunable(_worktreePointer); - /// Prunes working tree, that is removes the git data structures on disk. + /// Prunes working tree. /// - /// [flags] is optional combination of [GitWorktree] flags. - void prune([Set? flags]) { - bindings.prune( - worktreePointer: _worktreePointer, - flags: flags?.fold(0, (acc, e) => acc! | e.value), - ); - } + /// Prune the working tree, that is remove the git data structures on disk. + void prune() => bindings.prune(_worktreePointer); /// Whether worktree is valid. /// diff --git a/test/git_types_test.dart b/test/git_types_test.dart index 68ef591..cdbacaf 100644 --- a/test/git_types_test.dart +++ b/test/git_types_test.dart @@ -562,14 +562,4 @@ 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); - }); } diff --git a/test/worktree_test.dart b/test/worktree_test.dart index 550cf33..0da572a 100644 --- a/test/worktree_test.dart +++ b/test/worktree_test.dart @@ -151,22 +151,6 @@ void main() { expect(repo.worktrees, []); }); - test('prunes worktree with provided flags', () { - expect(repo.worktrees, []); - - 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, []); - }); - test('throws when trying get list of worktrees and error occurs', () { expect( () => Worktree.list(Repository(nullptr)),