Skip to main content

sync_worktree

Function sync_worktree 

Source
pub fn sync_worktree(
    store: &mut Store,
    repo: &Repo,
    cache: &ObjectCache,
    extractor: &dyn Extractor,
) -> Result<SyncReport, SyncError>
Expand description

Sync store to the working tree: the committed HEAD state with uncommitted working-tree changes overlaid on top (a pre-commit preview).

Committed blobs come from the content-addressed cache as in sync; then each tracked file whose working copy differs from its committed blob is re-extracted in memory (never cached, since dirty content is not a git object), deleted files are dropped, and brand-new untracked files (found via a gitignore-aware dirwalk, Repo::untracked_files) are overlaid in. The recorded sync state encodes the dirty set, so a later committed sync correctly supersedes the overlay.

ยงErrors

Returns a SyncError if git access, extraction caching, working-tree I/O, or the store rebuild fails.