3.6 KiB
Contributing
Updating libgit2
The following steps can be used to update libgit2:
-
Update the submodule. There are several ways to go about this. One way is to go to the
libgit2-sys/libgit2directory and rungit fetch originto download the latest updates, and then check out a specific tag (such asgit checkout v1.4.1). -
Update all the references to the version:
- Update
libgit2-sys/build.rs. There is a version probe (search forcfg.range_version) which should be updated. - Update the version in
libgit2-sys/Cargo.toml. Update the metadata portion (the part after the+) to match libgit2. Also bump the Cargo version (the part before the+), keeping in mind if this will be a SemVer breaking change or not. - Update the dependency version in
Cargo.tomlto match the version in the last step (do not include the+metadata). Also update the version of thegit2crate itself so it will pick up the change tolibgit2-sys(also keeping in mind if it is a SemVer breaking release). - Update the version in
README.mdif needed. There are two places, theCargo.tomlexample and the description of the libgit2 version it binds with. - If there was a SemVer-breaking version bump for either library, also update the
html_root_urlattribute in thelib.rsof each library.
- Update
-
Run tests.
cargo test -p git2 -p git2-curlis a good starting point. -
Run
systest. This will validate for any C-level API problems.cargo run -p systestThe changelog at https://github.com/libgit2/libgit2/blob/main/docs/changelog.md can be helpful for seeing what has changed. The project has recently started labeling API and ABI breaking changes with labels: https://github.com/libgit2/libgit2/pulls?q=is%3Apr+label%3A%22api+breaking%22%2C%22abi+breaking%22+is%3Aclosed
-
Once you have everything functional, publish a PR with the updates.
Release process
Checklist for preparing for a release:
- Make sure the versions have been bumped and are pointing at what is expected.
- Version of
libgit2-sys - Version of
git2 - Version of
git2-curl git2's dependency onlibgit2-sysgit2-curl's dependency ongit2- The libgit2 version probe in
libgit2-sys/build.rs - Update the version in
README.md - Check the
html_root_urlvalues in the source code.
- Version of
- Update the change logs:
There is a GitHub workflow to handle publishing to crates.io and tagging the release. There are two different ways to run it:
- In the GitHub web UI:
- Go to https://github.com/rust-lang/git2-rs/actions/workflows/publish.yml (you can navigate here via the "Actions" tab at the top).
- Click the "Run workflow" drop-down on the right.
- Choose which crates to publish. It's OK to leave everything checked, it will skip if it is already published. Uncheck a crate if the version has been bumped in git, but you don't want to publish that particular one, yet.
- Click "Run workflow"
- In the CLI:
- Run
gh workflow run publish.yml -R rust-lang/git2-rs
- Run