Skip to content

Mitts 0.3.6

Choose a tag to compare

@alex09x alex09x released this 27 Oct 07:12
· 474 commits to main since this release

Mitts 0.3.6 closes the gap between the ways Cargo obtains a crate and the ways Mitts did. Before this release a dependency existed for Mitts only if it came from crates.io or if Cargo had already checked it out; now every source Cargo's configuration can name works from that same configuration, without running Cargo, and a lockfile resolved by Mitts matches the one Cargo writes.

Git dependencies (300a44a, be007fd)

  • Mitts clones git dependencies itself with the system git: a bare mirror under <cache>/git/db/ and a working tree per locked commit under <cache>/git/checkouts/. SSH keys, agents, credential helpers and GIT_SSH_COMMAND apply unchanged; prompts are disabled so a missing credential fails instead of hanging. A checkout Cargo already made is reused.
  • Without a lockfile, the manifest's tag, branch or rev is resolved to a commit with git ls-remote (an annotated tag pins the tagged commit, as Cargo does), the package's own dependencies join the resolution, and the lock entry is written exactly as Cargo writes it. mitts fetch re-resolves when the reference moved. MITTS_GIT selects the git binary.

Registries, mirrors, vendoring, patches (31e4e5f)

  • Alternative sparse registries: [registries.<name>] index = "sparse+…" with registry = "<name>" on the dependency. The index's config.json gives the download template and auth-required; each index caches under <cache>/index/<digest>/, its packages under <cache>/sources/src-<digest>/. Git-index registries and local-registry sources are refused with advice.
  • Mirrors: [source.crates-io] replace-with = "<name>"; bytes come from the mirror, Cargo.lock keeps naming crates.io.
  • Vendored sources: [source.vendored-sources] directory = "vendor" for crates.io and git packages alike, verified against .cargo-checksum.json; without a lockfile the vendor directory serves as the index. No network is touched.
  • [patch.<source>] with path or git replacements, resolved and pinned without a lockfile and required to satisfy the requirement.

Credential providers (ef4d0ca)

  • Tokens come from Cargo's providers in Cargo's order: cargo:token (CARGO_REGISTRIES_<NAME>_TOKEN, [registries.<name>] token, credentials.toml), cargo:macos-keychain, cargo:libsecret, cargo:token-from-stdout <command>, and plugins such as cargo-credential-1password through the credential provider protocol. [registries.<name>] credential-provider, [registry] global-credential-providers (later entries first) and [credential-alias] are honoured.

Lockfile resolution (31e4e5f)

  • Resolution follows Cargo's rules: features flow along dependency edges (dep:, dep/feat, dep?/feat, implicit features, features2 from the index), an optional dependency of a transitive package enters only when a feature activates it, requirements in one compatibility range share one version, and errors name the package that required the unsatisfiable requirement. The previous resolver pulled every optional dependency of every package into the lock.
  • Cached index entries older than MITTS_INDEX_TTL_SECS (default 900) are re-read when online, so a fresh lockfile sees current versions.

Cargo config (e2fdd86)

  • [env] tables are applied with Cargo's force and relative rules to rustc, build scripts and the programs mitts run and mitts test start. A config holding one (a ~/.cargo/config.toml with SCCACHE_CACHE_SIZE, say) no longer makes Mitts refuse the whole configuration.

Checked against real projects

A private workspace with eight SSH git dependencies and no Cargo checkout cloned them all in 17 s and built from the clones; a public Cloudsmith sparse registry; two crates.io mirrors on Azure Artifacts (61 and 442 packages fetched); a committed 1000-crate vendor directory planned with the network cut; [patch] builds of two public projects; a library without a lockfile resolving to the same 101 packages cargo generate-lockfile resolves. Full isolated suite green on Linux and macOS, per-target store isolation probe clean, clippy clean.

Install or update:

cargo install mitts --version 0.3.6 --locked

Full history: v0.3.5...v0.3.6