wasm-git icon indicating copy to clipboard operation
wasm-git copied to clipboard

Support for Rust git2-rs compilation

Open samdenty opened this issue 2 years ago • 2 comments

Would it be possible to make the WASM version of libgit, work with the git2-rs bindings for Rust.

Rust is much easier to work with and has better support for WASM via wasm-bindgen. Having support for Rust, would make creating an in-browser git CLI using wasm-git for instance much easier, without being limited to what's in the libgit2 examples/ written in C

This was mentioned here https://github.com/rust-lang/git2-rs/issues/871

samdenty avatar Mar 27 '23 13:03 samdenty

Are there any updates on this?

christoph-det avatar Jul 09 '23 11:07 christoph-det

Wasm-git is compiled with emscripten, and also using the file system provided by emscripten. In order to integrate with Rust I think probably the best approach would be similar to how I've integrated quickjs with Rust in this project here: https://github.com/petersalomonsen/quickjs-rust-near

In that project quickjs is also compiled with emscripten, and when compiling to WebAssembly from Rust, the emscripten static libraries are linked in.

I'm not sure how this would work with the git2-rs bindings though, but it should at least be possible to interact with the c interfaces of libgit2 from Rust with such an approach.

petersalomonsen avatar Jul 09 '23 12:07 petersalomonsen