pub struct Worktree {Show 20 fields
pub schema_version: u32,
pub path: PathBuf,
pub branch: Option<String>,
pub slug: Option<String>,
pub is_current: bool,
pub is_main: bool,
pub is_missing: bool,
pub is_detached: bool,
pub dirty: Option<bool>,
pub has_untracked: Option<bool>,
pub ahead: Option<u32>,
pub behind: Option<u32>,
pub upstream: Option<String>,
pub base_ref: Option<String>,
pub commit: Option<Commit>,
pub pr: Option<Pr>,
pub has_worktree: bool,
pub recent_commits: Vec<Commit>,
pub pr_url: Option<String>,
pub merge_state: Option<MergeState>,
}Expand description
One worktree row — the stable §7 JSON schema shared by list, status, and
the new/pr/remove result objects.
Fields§
§schema_version: u32Schema version (always SCHEMA_VERSION).
path: PathBufAbsolute path of the worktree.
branch: Option<String>Full branch name, or None for a detached HEAD.
slug: Option<String>Filesystem-safe slug of the branch, or None when detached.
is_current: boolWhether this is the current worktree.
is_main: boolWhether this is the primary worktree.
is_missing: boolWhether the worktree’s directory has been deleted externally.
is_detached: boolWhether the worktree has a detached HEAD.
dirty: Option<bool>Whether tracked files are modified/staged; None when missing.
has_untracked: Option<bool>Whether untracked files are present; None when missing.
ahead: Option<u32>Commits ahead of upstream; None when no upstream or missing.
behind: Option<u32>Commits behind upstream; None when no upstream or missing.
upstream: Option<String>Upstream tracking branch (e.g. origin/feature/login); None if unset.
base_ref: Option<String>Base ref recorded at creation; None if unset.
commit: Option<Commit>Tip commit metadata; None when missing.
pr: Option<Pr>Recorded pull request; None when none.
has_worktree: boolWhether a checked-out worktree exists for this row. false marks a
“branch row”: a local branch with no worktree, listed beneath the real
worktrees with its ahead/behind relative to its base (issue #47). Not part
of the §7 JSON schema (where every row is a real worktree), so it is skipped
during serialization. Branch rows are normally TUI-only, but wt sync <branch> of a worktree-less branch emits one in --json; such a row’s
path is the branch://<branch> sentinel rather than a filesystem path,
since no checkout exists.
recent_commits: Vec<Commit>Up to the last five commits, for the TUI detail pane only. Not part of
the §7 JSON schema (which carries only the tip commit), so it is skipped
during serialization.
pr_url: Option<String>The recorded PR URL, for the TUI detail pane only. Not part of the §7
pr object, so it is skipped during serialization.
merge_state: Option<MergeState>Offline merge/tracking state, for delete-safety messaging in the TUI
only. None until enrichment runs (and for a missing worktree, where it
cannot be computed). Not part of the §7 JSON schema, so it is skipped
during serialization.
Implementations§
Source§impl Worktree
impl Worktree
Sourcepub fn new(path: PathBuf) -> Self
pub fn new(path: PathBuf) -> Self
Builds a worktree row with the given absolute path and all other fields
at their defaults (no branch, all flags false, all optionals None, and
has_worktree true — a real checkout). Callers populate the remaining
fields.
Sourcepub fn to_json_line(&self) -> Result<String>
pub fn to_json_line(&self) -> Result<String>
Serializes this row to a single-line JSON string (no trailing newline),
for the newline-delimited --json framing of list/status.
Trait Implementations§
impl Eq for Worktree
impl StructuralPartialEq for Worktree
Auto Trait Implementations§
impl Freeze for Worktree
impl RefUnwindSafe for Worktree
impl Send for Worktree
impl Sync for Worktree
impl Unpin for Worktree
impl UnsafeUnpin for Worktree
impl UnwindSafe for Worktree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more