cargo::sources::git

Function fetch

Source
pub fn fetch(
    repo: &mut Repository,
    remote_url: &str,
    reference: &GitReference,
    gctx: &GlobalContext,
    remote_kind: RemoteKind,
) -> CargoResult<()>
Expand description

Attempts to fetch the given git reference for a Git repository.

This is the main entry for git clone/fetch. It does the followings:

  • Turns GitReference into refspecs accordingly.
  • Dispatches git fetch using libgit2, gitoxide, or git CLI.

The remote_url argument is the git remote URL where we want to fetch from.

The remote_kind argument is a thing for -Zgitoxide shallow clones at this time. It could be extended when libgit2 supports shallow clones.