Skip to main content

Module fetcher

Module fetcher 

Source
Expand description

Git-based package fetcher.

The Fetcher trait abstracts over different fetch backends (git, luarocks, http). GitFetcher implements the git backend using libgit2 via the git2 crate. No subprocess git invocations are used.

§Cache layout

<cache_root>/git/<host>/<path…>/<sha>/

For example, https://github.com/ynishi/lshape at SHA abc123 becomes:

<cache_root>/git/github.com/ynishi/lshape/abc123/

If the directory already exists the clone is skipped.

§Authentication

GitFetcher uses a RemoteCallbacks-based credential cascade:

  1. SSH agent (Cred::ssh_key_from_agent) — tried only when the remote advertises SSH_KEY in allowed_types.
  2. Credential helper (Cred::credential_helper) — tried when USER_PASS_PLAINTEXT is advertised.
  3. Cred::default() — last resort.

The callback tracks attempted credential types to avoid infinite retry loops.

Structs§

FetchedPkg
Result of a successful Fetcher::fetch call.
GitFetcher
Fetcher implementation backed by libgit2.

Traits§

Fetcher
Abstraction over package fetch backends.