gix_worktree_state

Function checkout

source
pub fn checkout<Find>(
    index: &mut State,
    dir: impl Into<PathBuf>,
    objects: Find,
    files: &dyn Count,
    bytes: &dyn Count,
    should_interrupt: &AtomicBool,
    options: Options,
) -> Result<Outcome, Error>
where Find: Find + Send + Clone,
Expand description

Checkout the entire index into dir, and resolve objects found in index entries with objects to write their content to their respective path in dir. Use files to count each fully checked out file, and count the amount written bytes. If should_interrupt is true, the operation will abort. options provide a lot of context on how to perform the operation.

§Handling the return value

Note that interruption still produce an Ok(…) value, so the caller should look at should_interrupt to communicate the outcome.