class documentation

Information about a single worktree.

Method __eq__ Check equality with another WorkTreeInfo.
Method __init__ Initialize WorkTreeInfo.
Method __repr__ Return string representation of WorkTreeInfo.
Method open Open this worktree as a WorkTree.
Instance Variable bare Whether this is a bare repository
Instance Variable branch Current branch (if not detached)
Instance Variable detached Whether HEAD is detached
Instance Variable head Current HEAD commit SHA
Instance Variable lock_reason Reason for locking (if locked)
Instance Variable locked Whether the worktree is locked
Instance Variable path Path to the worktree
Instance Variable prunable Whether the worktree can be pruned
def __eq__(self, other: object) -> bool:

Check equality with another WorkTreeInfo.

def __init__(self, path: str, head: bytes | None = None, branch: Ref | None = None, bare: bool = False, detached: bool = False, locked: bool = False, prunable: bool = False, lock_reason: str | None = None):

Initialize WorkTreeInfo.

Parameters
path:strPath to the worktree
head:bytes | NoneCurrent HEAD commit SHA
branch:Ref | NoneCurrent branch (if not detached)
bare:boolWhether this is a bare repository
detached:boolWhether HEAD is detached
locked:boolWhether the worktree is locked
prunable:boolWhether the worktree can be pruned
lock_reason:str | NoneReason for locking (if locked)
def __repr__(self) -> str:

Return string representation of WorkTreeInfo.

def open(self) -> WorkTree:

Open this worktree as a WorkTree.

Returns
WorkTreeWorkTree object for this worktree
Raises
NotGitRepositoryIf the worktree path is invalid
bare =

Whether this is a bare repository

branch =

Current branch (if not detached)

detached =

Whether HEAD is detached

head =

Current HEAD commit SHA

lock_reason =

Reason for locking (if locked)

locked =

Whether the worktree is locked

path =

Path to the worktree

prunable =

Whether the worktree can be pruned