mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(worktree): add more bindings and api methods
This commit is contained in:
parent
9f346c99f7
commit
15ce546f7a
3 changed files with 119 additions and 4 deletions
|
@ -52,6 +52,29 @@ class Worktree {
|
|||
/// Returns the filesystem path for the worktree.
|
||||
String get path => bindings.path(_worktreePointer);
|
||||
|
||||
/// Checks if worktree is locked.
|
||||
///
|
||||
/// A worktree may be locked if the linked working tree is stored on a portable
|
||||
/// device which is not available.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
bool get isLocked => bindings.isLocked(_worktreePointer);
|
||||
|
||||
/// Locks worktree if not already locked.
|
||||
void lock() => bindings.lock(_worktreePointer);
|
||||
|
||||
/// Unlocks a locked worktree.
|
||||
void unlock() => bindings.unlock(_worktreePointer);
|
||||
|
||||
/// Checks if the worktree prunable.
|
||||
///
|
||||
/// A worktree is not prunable in the following scenarios:
|
||||
/// - the worktree is linking to a valid on-disk worktree.
|
||||
/// - the worktree is locked.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
bool get isPrunable => bindings.isPrunable(_worktreePointer);
|
||||
|
||||
/// Prunes working tree.
|
||||
///
|
||||
/// Prune the working tree, that is remove the git data structures on disk.
|
||||
|
@ -59,6 +82,12 @@ class Worktree {
|
|||
/// Throws a [LibGit2Error] if error occured.
|
||||
void prune() => bindings.prune(_worktreePointer);
|
||||
|
||||
/// Checks if worktree is valid.
|
||||
///
|
||||
/// A valid worktree requires both the git data structures inside the linked parent
|
||||
/// repository and the linked working copy to be present.
|
||||
bool get isValid => bindings.isValid(_worktreePointer);
|
||||
|
||||
/// Releases memory allocated for worktree object.
|
||||
void free() => bindings.free(_worktreePointer);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue