Skip to main content

clone_or_update

Function clone_or_update 

Source
pub fn clone_or_update(
    options: &CloneOptions,
    dest: &Path,
) -> Result<(), CloneError>
Expand description

Clone options.url into dest, or fetch + checkout if dest already exists.

When dest already contains a .git directory the function runs git fetch origin followed by an optional git checkout <ref>. Otherwise it performs a fresh git clone, honouring the optional depth and ref fields in CloneOptions.

ยงErrors

Returns CloneError::Git when a git command exits with a non-zero status, carrying the stderr output. Returns CloneError::Io when the git binary cannot be spawned.