Skip to main content

Module worktree

Module worktree 

Source
Expand description

Tree snapshots of uncommitted state (ADR 0017): the index and the worktree as plain tree oids, so the rest of the pipeline — diff-tree enumeration, the invariants, blob reads — runs on them unchanged.

Plumbing only, and never the user’s index: a temporary GIT_INDEX_FILE is seeded from ls-files -s -z piped into update-index -z --index-info. Snapshot blobs land in the odb (unreferenced, gc-able), which pins the content so later cat-file reads by <tree>:<path> always resolve.

Functions§

index_tree
Tree oid of the current index (the staged state). The user’s index file is never written to.
is_clean
Whether a worktree snapshot would differ from HEAD at all.
worktree_tree
Tree oid of the worktree: every tracked file’s current content plus untracked-but-not-ignored files, with worktree deletions honoured.