Skip to content

Conversation

@weihanglo
Copy link
Contributor

This would be useful for user to determine whether they want to proceed
or bail further remote operations. Particularily useful for downstream
libgit2 bindings and applications to experiment SHA256 support behind a
runtime feature flag.

For example, cargo could compile with sha256 support unconditionally,
but reject SHA256 usage at runtime if the -Zgit=sha256 nightly flag
was not on. Cargo would leverage this new API to determine if users are
trying to fetch a SHA256 remote repository and bail when needed before
any fetches happen.


If there is any better alternative than this to do runtime SHA256 support check for tools like Cargo, please share!

cc rust-lang/git2-rs#1090 and rust-lang/cargo#14942

@ethomson
Copy link
Member

If this is useful for you, I don't mind exposing it, but let's remote it from src/libgit2/remote.h to keep things tidy. 🙏

This would be useful for user to determine whether they want to proceed
or bail further remote operations. Particularily useful for downstream
libgit2 bindings and applications to experiment SHA256 support behind a
runtime feature flag.

For example, `cargo` could compile with sha256 support unconditionally,
but reject SHA256 usage at runtime if the `-Zgit=sha256` nightly flag
was not on. Cargo would leverage this new API to determine if users are
trying to fetch a SHA256 remote repository and bail when needed before
any fetches happen.

Note that this is not gated behind `GIT_EXPERIMENTAL_SHA256` as the
oid_type is sha1 and available always.
@weihanglo
Copy link
Contributor Author

Thanks again for the review. The header got updated!

BTW, mind asking when we plan to do a minor release?

@ethomson
Copy link
Member

BTW, mind asking when we plan to do a minor release?

🔜 This week or so, I think. There's a lot of good stuff ready to release!

@ethomson ethomson merged commit 53eca10 into libgit2:main Jan 11, 2026
19 checks passed
@weihanglo weihanglo deleted the remote-oid-type branch January 11, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants