Skip to content
Français

WorkspaceGitState

The fields below cover all variants; the signature specifies their allowed combinations.

  • stateRequired
    "registered" | "unregistered" | "unavailable" | "skipped"
    registered: a Git worktree of this repository; unregistered: not listed by git worktree list; skipped: not a directory; unavailable: inspection failed, see reason.
  • headVariant-dependent
    string
    HEAD commit listed by git worktree list.
  • branchVariant-dependent
    string | null
    Worktree branch name, or null when HEAD is detached.
  • dirtyVariant-dependent
    boolean
    true when git status reports tracked or untracked changes. Ignored files do not count.
  • lockedVariant-dependent
    boolean
    Whether Git marks the worktree as locked.
  • reasonVariant-dependent
    string
    Why the state is skipped (NOT_DIRECTORY) or unavailable, such as WORKSPACE_CHANGED, REGISTRATION_MISMATCH or GIT_INSPECTION_FAILED.
export type WorkspaceGitState =
  | {
      readonly state: "registered";
      readonly head: string;
      readonly branch: string | null;
      readonly dirty: boolean;
      readonly locked: boolean;
    }
  | {
      readonly state: "unregistered";
    }
  | {
      readonly state: "skipped" | "unavailable";
      readonly reason: string;
    };