fetch method

  1. @override
Future<void> fetch(
  1. GitFileRepository repository, {
  2. String? remote,
  3. List<String>? refspecs,
  4. bool prune = false,
  5. GitTagFetch tags = GitTagFetch.follow,
})
inherited

Downloads objects and refs from remote into repository (git fetch), running inside that repository's context.

remote is a configured remote name or a remote location in one of the accepted forms documented on this class. Without remote, git fetches from the default remote of the checked out branch, origin after a normal clone. refspecs restrict the refs to fetch and map them (e.g. main:refs/heads/other); they require remote. With prune, refs the remote no longer has are deleted too.

tags selects which tags come along: GitTagFetch.follow (the default) brings the tags that designate the commits the fetch retrieves, GitTagFetch.all brings every tag of the remote, and GitTagFetch.none brings no tag at all.

Throws GitUnsupportedUrlException without running git when remote is not in an accepted form, GitRemoteRefNotFoundException when a refspecs entry names a ref the remote does not have, GitAuthenticationException when the remote refused or demanded credentials, GitRemoteUnreachableException when the remote host could not be reached, and GitRemoteRepositoryNotFoundException when no repository exists at the remote location.

Implementation

@override
Future<void> fetch(
  GitFileRepository repository, {
  String? remote,
  List<String>? refspecs,
  bool prune = false,
  GitTagFetch tags = GitTagFetch.follow,
}) async {
  await _fetch(
    repository,
    remote: remote,
    refspecs: refspecs,
    prune: prune,
    tags: tags,
  );
}