Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cargo can silently fix some bad lockfiles (use --locked to disable) #5831
Lock files often get corrupted by git merge. This makes all cargo commands silently fix that kind of corruption.
If you want to be sure that your CI does not change the lock file you have commited
Then make sure to use
Edit: original description below
This adds a
I think the open questions for this pr relate to testing.
An amateur's LGTM, from me.
The only other suggestion I could give is you have such wonderful terse sum type syntax in Rust (https://twitter.com/dwijnand/status/859338631982567424), I'd suggest considering creating and using one instead of using opaque
bool. But it might not feel right in the codebase.
[edit: oh and thank you for last mile-ing this!)
Thanks! I think actually we may want to unconditionally ignore errors for these sorts of lockfiles. Cargo 99% of the time is about to regenerate a lockfile anyway, so the purpose of the previous lockfile is basically just there to influence the next build as much as possible. If it ends up being corrupt in some subtle ways then it should be fine to always discard as we'd be about to make a new one anyway
@Eh2406 hm do you think this strategy isn't the right one?
If a repository has a lock file checked in it's recommended to build with