Question: Managing Cargo/Crates.io versions in interaction with Git.
Hello everyone,
Since about 2 months I have been working on some projects. It made me wonder how people handle different Cargo/Crates.io versions in interaction with Git.
For example: Let's say I currently have a project version 1.0.0 and multiple people are working on it at the same time. Would they then all increment it to 1.0.1 on their specific branch / Pull Request? That would mean that if one PR would be merged others would automatically have to be updated with new numbers.
Or would a better approach be to use 1.0.0 for all Pull Requests and then do a different commit on master when the newly merged PR would together form 1.0.1? This however then would mean that the master branch (prior to 1.0.1 being released) would contain a more up to date version than crates.io.
I was wondering if would share your wisdom with me about this issue or if I am missing some key knowledge. If things could somehow be automated using for example Travis CI, that would be even better of course.
Posted Feb 6, 2019, 9:02 AM UTC
Why would that be an issue?
It's not a huge issue, and for some maintainers common practice to directly make a commit incrementing to the next version after publishing a release.
However it creates the problem that you can't patch a dependency in your Cargo.toml with a git dependency that e.g. has a bug fix that is not released yet by the maintainer, as cargo only allows patching with the same version number. There has been more than one occasion where I had to fork and decrement the version again to be able to patch a dependency.
I never thought about the idea to directly make a commit right after the release, thanks for that insight. It does however feel kind of ugly (in my opinion) to have separate commits just to represent that a certain version has been reached. I feel Git Tags should be used for those kind of things. But I guess its something we just need to deal with! I do really like Cargo and how easy it is to load other dependencies.