bundle: accept only remote git URLs as cargo sources

Neither a local path nor a file:// URL resolves on another machine, so
both are rejected when the Brewfile is parsed. A crate cargo reports as
installed from one is dumped as a registry crate rather than dropped,
with a warning naming the origin that could not be expressed.
This commit is contained in:
James Felix Black
2026-08-06 11:51:28 -04:00
parent 7b7896482f
commit bc5662a7b6
3 changed files with 87 additions and 32 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ flatpak "io.github.dvlv.boxbuddyrs", remote: "flathub-beta"
WinGet installs run with installer interactivity disabled. If WinGet reports that elevation is required, `brew bundle` retries through Windows UAC.
A Cargo package's `source:` is a git URL (`https://`, `ssh://`, `git://` or `file://`) or a local path, and is installed with `cargo install --git` or `cargo install --path` respectively. The name is the crate's package name from its `Cargo.toml`, which is not always the name of the repository or of the binary it installs, so `brew bundle dump` output is the reliable thing to copy. A branch, tag or revision chosen when the package was installed is carried in the URL as `?branch=`, `?tag=` or `?rev=`, and is restored with the corresponding `cargo install` flag. Where none was chosen, only the repository is recorded and not the commit currently installed, so restoring a `Brewfile` builds the repository's default branch rather than the exact commit.
A Cargo package's `source:` is a git URL (`https://`, `ssh://` or `git://`) and is installed with `cargo install --git`. Neither a local path nor a `file://` URL is accepted, since neither resolves on another machine, and a crate installed from one is dumped without a `source:`. The name is the crate's package name from its `Cargo.toml`, which is not always the name of the repository or of the binary it installs, so `brew bundle dump` output is the reliable thing to copy. A branch, tag or revision chosen when the package was installed is carried in the URL as `?branch=`, `?tag=` or `?rev=`, and is restored with the corresponding `cargo install` flag. Where none was chosen, only the repository is recorded and not the commit currently installed, so restoring a `Brewfile` builds the repository's default branch rather than the exact commit.
Run `brew bundle` again and this outputs: