| 1 |
# Contributing |
| 2 |
|
| 3 |
## Updating libgit2 |
| 4 |
|
| 5 |
The following steps can be used to update libgit2: |
| 6 |
|
| 7 |
1. Update the submodule. |
| 8 |
There are several ways to go about this. |
| 9 |
One way is to go to the `libgit2-sys/libgit2` directory and run `git fetch origin` to download the latest updates, and then check out a specific tag (such as `git checkout v1.4.1`). |
| 10 |
2. Update all the references to the version: |
| 11 |
* Update [`libgit2-sys/build.rs`](https://github.com/rust-lang/git2-rs/blob/main/libgit2-sys/build.rs). |
| 12 |
There is a version probe (search for `cfg.range_version`) which should be updated. |
| 13 |
* Update the version in |
| 14 |
[`libgit2-sys/Cargo.toml`](https://github.com/rust-lang/git2-rs/blob/main/libgit2-sys/Cargo.toml). |
| 15 |
Update the metadata portion (the part after the `+`) to match libgit2. |
| 16 |
Also bump the Cargo version (the part before the `+`), keeping in mind |
| 17 |
if this will be a SemVer breaking change or not. |
| 18 |
* Update the dependency version in [`Cargo.toml`](https://github.com/rust-lang/git2-rs/blob/main/Cargo.toml) to match the version in the last step (do not include the `+` metadata). |
| 19 |
Also update the version of the `git2` crate itself so it will pick up the change to `libgit2-sys` (also keeping in mind if it is a SemVer breaking release). |
| 20 |
* Update the version in [`README.md`](https://github.com/rust-lang/git2-rs/blob/main/README.md) if needed. |
| 21 |
There are two places, the `Cargo.toml` example and the description of the libgit2 version it binds with. |
| 22 |
* If there was a SemVer-breaking version bump for either library, also update the `html_root_url` attribute in the `lib.rs` of each library. |
| 23 |
3. Run tests. |
| 24 |
`cargo test -p git2 -p git2-curl` is a good starting point. |
| 25 |
4. Run `systest`. |
| 26 |
This will validate for any C-level API problems. |
| 27 |
|
| 28 |
`cargo run -p systest` |
| 29 |
|
| 30 |
The changelog at <https://github.com/libgit2/libgit2/blob/main/docs/changelog.md> |
| 31 |
can be helpful for seeing what has changed. |
| 32 |
The project has recently started labeling API and ABI breaking changes with labels: |
| 33 |
<https://github.com/libgit2/libgit2/pulls?q=is%3Apr+label%3A%22api+breaking%22%2C%22abi+breaking%22+is%3Aclosed> |
| 34 |
Alternatively, running `git diff [PREV_VERSION]..[NEW_VERSION] --ignore-all-space -- include/` can provide an overview of changes made to the API. |
| 35 |
4. Once you have everything functional, publish a PR with the updates. |
| 36 |
|
| 37 |
## Release process |
| 38 |
|
| 39 |
Checklist for preparing for a release: |
| 40 |
|
| 41 |
- Make sure the versions have been bumped and are pointing at what is expected. |
| 42 |
- Version of `libgit2-sys` |
| 43 |
- Version of `git2` |
| 44 |
- Version of `git2-curl` |
| 45 |
- `git2`'s dependency on `libgit2-sys` |
| 46 |
- `git2-curl`'s dependency on `git2` |
| 47 |
- The libgit2 version probe in `libgit2-sys/build.rs` |
| 48 |
- Update the version in `README.md` |
| 49 |
- Check the `html_root_url` values in the source code. |
| 50 |
- Update the change logs: |
| 51 |
- [`CHANGELOG.md`](https://github.com/rust-lang/git2-rs/blob/main/CHANGELOG.md) |
| 52 |
- [`libgit2-sys/CHANGELOG.md`](https://github.com/rust-lang/git2-rs/blob/main/libgit2-sys/CHANGELOG.md) |
| 53 |
- [`git2-curl/CHANGELOG.md`](https://github.com/rust-lang/git2-rs/blob/main/git2-curl/CHANGELOG.md) |
| 54 |
|
| 55 |
There is a GitHub workflow to handle publishing to crates.io and tagging the release. There are two different ways to run it: |
| 56 |
|
| 57 |
- In the GitHub web UI: |
| 58 |
1. Go to <https://github.com/rust-lang/git2-rs/actions/workflows/publish.yml> (you can navigate here via the "Actions" tab at the top). |
| 59 |
2. Click the "Run workflow" drop-down on the right. |
| 60 |
3. 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. |
| 61 |
4. Click "Run workflow" |
| 62 |
- In the CLI: |
| 63 |
1. Run `gh workflow run publish.yml -R rust-lang/git2-rs` |