git2-rs icon indicating copy to clipboard operation
git2-rs copied to clipboard

libgit2: Bump to v1.8.0

Open bnjmnt4n opened this issue 1 year ago • 6 comments

This PR bumps libgit2 to v1.8.0, in preparation for #1031. I've bumped libgit2-sys to 0.17.0+1.8.0, but haven't touched the git2 version since I thought that's better left for the maintainers.

I haven't included any new Rust bindings for the new functions (e.g. git_commit_create_from_stage). Basically I've just done the bare minimum required to get the libgit2 v1.8.0 working.

API changes:

  • Remote:update_tips now accepts a RemoteUpdateFlags which is an integer consisting of bitfields instead of a boolean
  • FetchOptions: add report_unchanged method which updates the update_flags bitflag (similar to above)
  • PushOptions: add remote_push_options method to set remote push options
  • WorktreeAddOptions: add checkout_existing method to set the boolean checkout_existing option

References

  • https://github.com/libgit2/libgit2/blob/main/docs/changelog.md#v18

bnjmnt4n avatar Mar 02 '24 14:03 bnjmnt4n

Looks like the current test failures are due to changes made in https://github.com/libgit2/libgit2/pull/6743 👀

bnjmnt4n avatar Mar 07 '24 09:03 bnjmnt4n

Looks like v1.8.0 is out! I will update the PR to bump the version.

bnjmnt4n avatar Mar 22 '24 11:03 bnjmnt4n

This should be ready for review. (I'm pretty new to Rust and the libgit2 / this codebase, please do let me know if there are better ways to do anything.)

The test failures on Windows are related to https://github.com/libgit2/libgit2/pull/6743 as mentioned above—I'm not too sure how to handle these conventionally using Rust.

bnjmnt4n avatar Mar 22 '24 13:03 bnjmnt4n

The test failures on Windows are related to libgit2/libgit2#6743 as mentioned above—I'm not too sure how to handle these conventionally using Rust.

Hm, that's awkward. I don't really understand why TempDir is returning short path. One option is to canonicalize both paths before comparing they are equal. Another option is to use same-file to check that the paths are the same. Canonicalize might be easier if it works.

ehuss avatar Mar 23 '24 20:03 ehuss

FYI, this blocks the upgrade of libgit2 to 1.8.0 in Alpine Linux (!63296).

jirutka avatar Apr 03 '24 10:04 jirutka

Is this PR still blocked? this may fix https://github.com/actions/checkout/issues/1689

SS1823 avatar Apr 23 '24 14:04 SS1823

Approved 2 weeks ago, but still not merged… why?

jirutka avatar May 14 '24 22:05 jirutka

@jirutka libgit 1.8.0 has used C bitfields in its ABI, and that feature is not supported by Rust's FFI and may be compiler-specific.

https://github.com/libgit2/libgit2/issues/6800

kornelski avatar May 14 '24 23:05 kornelski

libgit2 v1.8.1 was just released, and I've updated the PR to use that. Bitfields are no longer used in the new version, so we can avoid any hacks.

bnjmnt4n avatar May 16 '24 11:05 bnjmnt4n