Skip to main content

checkout_detached

Function checkout_detached 

Source
pub fn checkout_detached(
    dest: &Path,
    cache_git_dir: &Path,
    commit: &str,
) -> Result<(), GitError>
Expand description

Build a thin instance checkout at dest: a non-bare repo whose objects are borrowed from cache_git_dir via objects/info/alternates, HEAD detached at commit, and the commit’s tree written into the working tree.

Re-materialization rebuilds from scratch: any existing checkout at dest is removed first (provably correct against a dirty or stale worktree, and the cache holds the objects so the rebuild copies nothing across repos).