git2-rs
git2-rs copied to clipboard
Runtime error if zlib-ng feature is missing
If zlib-ng is enabled through any other dependency but the git2/zlib-ng-compat feature is missing a error reading from the zlib stream; class=Zlib (5). is shown at runtime. This error is very hard to debug because there is no indication that this is caused by zlib-ng. Minimal example:
[package]
name = "git-repro"
version = "0.1.0"
edition = "2021"
[dependencies]
git2 = "0.14.4"
# To enable zlib-ng-compat for the zig build
libssh2-sys = { version = "0.2.23" }
[features]
default = ["vendored"]
vendored = ["git2/vendored-libgit2", "git2/vendored-openssl"]
zlib-ng-compat = ["libssh2-sys/zlib-ng-compat"]
use git2::Repository;
fn main() {
Repository::clone(
"https://github.com/IQTLabs/hypothesis-bio",
"hypothesis-bio",
)
.unwrap();
println!("Hello, world!");
}
Fails (Error { code: -1, klass: 5, message: "error reading from the zlib stream" }):
cargo run --features vendored --features zlib-ng-compat
Passed:
cargo run --features vendored