Skip to main content

worktree_id

Function worktree_id 

Source
pub fn worktree_id(path: &Path) -> Result<WorktreeId, ExecError>
Expand description

Derive a stable, opaque id for the checkout at path.

The id is the first 16 hex characters of the SHA-256 of the path in absolute form. It is deliberately not the path itself: a layer key is stored and printed, and a local filesystem path is user-identifying data that has no business in a persisted record. Resolution is lexical (std::path::absolute), so the id is stable and does not depend on the checkout existing.

ยงErrors

Returns ExecError::Identity if the derived token is somehow not a well-formed WorktreeId.