Repository navigation
Conversation
msuozzo
force-pushed
the
push-knnuksvulkut
branch
from
October 11, 2026 19:44
5760bf7 to
5d3f083
Compare
Contributor
Author
|
I intend to incorporate the changes from #1316, which run the test suite on WASI, once libz-sys releases the fix they need (rust-lang/libz-sys#276). |
msuozzo
force-pushed
the
push-knnuksvulkut
branch
2 times, most recently
from
October 12, 2026 16:25
5d3f083 to
c770a67
Compare
Contributor
Author
|
libz-sys 1.1.30 is out, so I've folded in #1316. libgit2-sys now requires 1.1.30, and the WASI job runs the test suite under wasmtime. |
msuozzo
force-pushed
the
push-knnuksvulkut
branch
from
October 31, 2026 13:20
c770a67 to
dbd505f
Compare
Get git2 build running for the `wasm32-wasip1` target. Given its lack of socket support, this necessarily excludes the `https` and `ssh` features for now (although wasip2 does add sockets). The only change for non-WASI users is that libgit2-sys bumps the version of libz-sys to 1.1.30 (see rust-lang/libz-sys#273). On WASI, libgit2-sys requires the `vendored` feature, so libgit2 can be compiled with a few local changes: - `NO_MMAP` is defined. - `GIT_THREADS` is off, ensuring `wasm32-wasip1-threads` won't build, which would otherwise make git2 `Send` types unsound. - `streams/socket.c` is stubbed out to return an error. - `libgit2-sys/wasi/` stubs the user and process IDs and `pwd.h`, which wasi-libc lacks. The home directory comes from `$HOME`. - `-Wno-incompatible-pointer-types` works around a type mismatch in `integer.h` until libgit2/libgit2#7406 lands. git2 itself needed two fixes to work on WASI. Its path conversions only had unix and windows versions, so a wasi-specific variant is needed to compile. std's `env::join_paths` also always fails on WASI, which made every `Repository::open_ext` and `discover_path` call fail. The fix is to re-implement those joins for wasi ourselves. The new WASI CI job builds with wasi-sdk and runs the tests under wasmtime on stable, beta and nightly. On MSRV (1.87), CI only builds, since std's `remove_dir_all` is buggy on WASI before Rust 1.94. git2 itself doesn't use it. Most of the test diff swaps `TempDir::new()` for a `test::tempdir()` helper. std has no temp directory on WASI, so the helper points tempfile at `/tmp`, which the CI runner preopens. Four tests are skipped on WASI: - `compile_fail` runs cargo. - `non_utf8_branch` needs non-UTF-8 paths. - `keeping_original_author_msg` and `prune` remove directories through paths with a trailing slash, which wasmtime rejects pending release of the fix (bytecodealliance/wasmtime#14662).
msuozzo
force-pushed
the
push-knnuksvulkut
branch
from
October 31, 2026 13:25
dbd505f to
3d2d0c0
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Get git2 build running for the
wasm32-wasip1target. Given its lack ofsocket support, this necessarily excludes the
httpsandsshfeaturesfor now (although wasip2 does add sockets).
The only change for non-WASI users is that libgit2-sys bumps the version
of libz-sys to 1.1.30 (see rust-lang/libz-sys#273).
On WASI, libgit2-sys requires the
vendoredfeature, so libgit2 can becompiled with a few local changes:
NO_MMAPis defined.GIT_THREADSis off, ensuringwasm32-wasip1-threadswon't build,which would otherwise make git2
Sendtypes unsound.streams/socket.cis stubbed out to return an error.libgit2-sys/wasi/stubs the user and process IDs andpwd.h, whichwasi-libc lacks. The home directory comes from
$HOME.-Wno-incompatible-pointer-typesworks around a type mismatch ininteger.huntil integer: use type-generic overflow intrinsics for size_t libgit2/libgit2#7406 lands.git2 itself needed two fixes to work on WASI. Its path conversions only
had unix and windows versions, so a wasi-specific variant is needed to
compile. std's
env::join_pathsalso always fails on WASI, which madeevery
Repository::open_extanddiscover_pathcall fail. The fix isto re-implement those joins for wasi ourselves.
The new WASI CI job builds with wasi-sdk and runs the tests under
wasmtime on stable, beta and nightly. On MSRV (1.87), CI only builds,
since std's
remove_dir_allis buggy on WASI before Rust 1.94. git2itself doesn't use it.
Most of the test diff swaps
TempDir::new()for atest::tempdir()helper. std has no temp directory on WASI, so the helper points tempfile
at
/tmp, which the CI runner preopens.Four tests are skipped on WASI:
compile_failruns cargo.non_utf8_branchneeds non-UTF-8 paths.keeping_original_author_msgandpruneremove directories throughpaths with a trailing slash, which wasmtime rejects pending release of
the fix (wasi: remove directories named with a trailing slash bytecodealliance/wasmtime#14662).