petersalomonsen / wasm-git

GIT for nodejs and the browser using https://libgit2.org compiled to WebAssembly with https://emscripten.org
Other
649 stars 37 forks source link

How to use wasm-git with different version of libgit2? #73

Closed nikitavoloboev closed 1 year ago

nikitavoloboev commented 1 year ago

I need to do a sparse clone with libgit2 and the current wasm-git doesn't expose this feature.

However there is this PR that passes tests but sadly not yet merged into main tree of libgit2.

I need the sparse clone feature and I need to run libgit2 with wasm so I thought I build the libgit2 from the pr and expose it through wasm-git. One thing I am not sure about is where would I start with this.

I thought I should look into the build.sh file but I didn't see where in there the chosen libgit2 version is picked. I assume somewhere a clone happens, perhaps I can change that clone to point to clone the PR instead and then leave the other instructions as they are?

Thank you for any help.

nikitavoloboev commented 1 year ago

Or wait I see this line in setup.sh:

curl -L https://github.com/libgit2/libgit2/archive/refs/tags/v1.5.0.tar.gz --output libgit2.tar.gz

I guess that points to the build of 1.5.0 version.

So I need to do these steps on that PR:

image

And get the build file so I can use it with wasm-git?

petersalomonsen commented 1 year ago

You only need to get the sources of the libgit2 version you want to build. And then let the wasm-git build scripts should build both libgit2 and the wasm-git specifics. However there have always been some adjustments needed to be done between versions. From the history of wasm-git you can see that I've done several upgrades of the libgit2 version ( planning a new one quite soon too ), and quite often there are things to adjust.

nikitavoloboev commented 1 year ago

Created a fork of wasm-git with my progress: https://github.com/nikitavoloboev/wasm-git

I have a feeling many things will break but maybe miracles happen. 😺

nikitavoloboev commented 1 year ago

Thanks to @petersalomonsen managed to build it with that pr.