Skip to main content

parse_worktree_list_porcelain

Function parse_worktree_list_porcelain 

Source
pub fn parse_worktree_list_porcelain(
    output: &[u8],
    nul_delimited: bool,
) -> Result<Vec<WorktreeHandle>, WorktreeError>
Expand description

Parse the porcelain output of git worktree list into WorktreeHandles.

Handles both NUL-delimited (git -z, available on Git >= 2.36) and newline-delimited layouts: each worktree is one block of key-value lines, and blocks are separated by double-NUL (or a blank line).

Path bytes are preserved end-to-end on Unix via OsStr::from_bytes so non-UTF8 paths survive through to std::path::PathBuf. Branch names, HEAD SHAs, and keyword markers are ASCII in practice and are decoded lossily.