Add gitoxide as Git backend - #96
Conversation
| check-gix: | ||
| name: cargo check (gix) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| toolchain: | ||
| # It should always run on stable | ||
| - stable | ||
| # 1.82 is the MSRV of `gix`, but 1.83 is needed for icu_collections and friends, which is pulled in by `git2` via `url`. | ||
| - "1.83" | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: ${{ matrix.toolchain }} | ||
| - run: cargo check --no-default-features --features gix | ||
| - run: cargo check --all-features | ||
|
|
There was a problem hiding this comment.
All this could go away if built could upgrade to an MSRV of v1.82.
| strategy: | ||
| matrix: | ||
| toolchain: [stable, "1.83"] | ||
| toolchain: [ stable, "1.83" ] |
There was a problem hiding this comment.
This wasn't intentional, but an IDE thing that I just now noticed.
| /// | ||
| /// # Errors | ||
| /// Errors from `git2` are returned if the repository does exists at all. | ||
| /// or if any operation on the repository fails, `None` is returned. |
There was a problem hiding this comment.
This was done as the error was always ignored, so it's easier to go with Option from the beginning.
| //! /// Can be overridden using `BUILT_OVERRIDE_{pkg_name}_GIT_COMMIT_HASH_SHORT`. | ||
| //! pub static GIT_COMMIT_HASH_SHORT: Option<&str> = Some("ca2af4f"); | ||
| //! ``` | ||
| //! | ||
| //! ### `gix` |
There was a problem hiding this comment.
I started out with Copilot, but replaced everything except for these docs. Maybe review extra diligently, they might have subtle errors.
- Added gix dependency with minimal features (max-performance-safe) - Created git_shared module to share code between git2 and gix - Implemented gix-based git operations in new gix module - git2 takes priority when both features are enabled - Tests pass for both implementations - Adjusted integration tests to validate `gix` as well. - Document gix as alternative to git2 for git operations
|
Thanks for the PR! Some nits:
Could you make these changes? |
|
Thanks a lot for the timely review! I will be hitting the keyboard to address it in a separate commit.
Great, I will bump it to 1.85 and remove the CI special case.
Yes, that's all good now. And I say that with the disclaimer that I have no memory about that discussion whatsoever.
Ouch, sorry for that. I didn't realise these were public, but now saw that they are (quite sneakily) exported via the Tasks
|
6ea30ea to
8105273
Compare
|
Under the assumption that CI is green this could be it. But please also let me note that I am not at all sure that I have implemented the MSRV change correctly, as there is some special sauce that I probably got wrong. Thus I hope you could finish the MSRV change for me if adjustments are needed, you should be able to push straight into my branch, and that works automatically if you checked out with Thanks again, I am excited to see this long-standing effort to finally come to fruition. PS: Please do feel free to rewrite my commits as well or squash them, my signature isn't important. |
|
Thanks for the PR. I'm going to make some changes on top of this. Critically, CI currently does not actually execute the git-tests at all with only the |
|
Thanks for merging! I didn't have time to double-check this, but not running And from all I can tell, These correspond to the following lines in the CI configuration: The |

Fixes #66
Highlights
git2implementation was simplified and I find the whole implementation easier to understand than before.Shortcomings
gixneeds Rustc v1.82, butbuiltis onv1.81. That's not a problem as long asgix` isn't the default.git2pulls inurlwhich has dependencies that need v1.83 by now, but CI doesn't have issues.get_repo_description()intodirtyandtag. This is inherited though, and that could be fixed in a follow-up. Right now, ifdirtyis overridden, but nottag, it would still computedirtybut ignore the computed value.gixmight be slower fordescribe()than it has to be. I'd be OK with this for now, thinking that one day they might build these scripts in release mode or make that configurable.Tasks