nix-community / crate2nix

rebuild only changed crates in CI with crate2nix and nix
https://nix-community.github.io/crate2nix/
Apache License 2.0
338 stars 82 forks source link

improve git branch parsing and cargo config serialization #280

Closed apoelstra closed 1 year ago

apoelstra commented 1 year ago

When it comes to git dependencies, cargo is very finicky, and it turns out you basically have to copy the exact logic of 'cargo vendor' to get it to work. This means:

I'm unsure what to do if both a tag and a branch are specified, since it looks like cargo vendor treats branch and tag references as disjoint things. Right now I just serialize both fields, but I believe this is incorrect and one should take precedence.

Next, when fetching dependencies via fetchGit, we need to interpret the URL data slightly differently:

apoelstra commented 1 year ago

For reference, to justify my claims about what cargo does:

apoelstra commented 1 year ago

Force-push to change tag refs to be refs/tags/${parsed.tag} rather than just parsed.tag.

Ericson2314 commented 1 year ago

Oh thank you very much for this! I think it might fix some issues I too was having.

Ericson2314 commented 1 year ago

The test failure is just a reformat, I will fix.