cargo::sources::git::utils

Function github_fast_path

Source
fn github_fast_path(
    repo: &mut Repository,
    url: &str,
    reference: &GitReference,
    gctx: &GlobalContext,
) -> CargoResult<FastPathRev>
Expand description

Attempts GitHub’s special fast path for testing if we’ve already got an up-to-date copy of the repository.

Updating the index is done pretty regularly so we want it to be as fast as possible. For registries hosted on GitHub (like the crates.io index) there’s a fast path available to use1 to tell us that there’s no updates to be made.

Note that this function should never cause an actual failure because it’s just a fast path. As a result, a caller should ignore Err returned from this function and move forward on the normal path.