petersalomonsen / wasm-git

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

failed to create locked file when git clone #23

Closed ylc395 closed 3 years ago

ylc395 commented 3 years ago

version:0.0.4

I'm trying to use wasm-git in a worker, which is spawned in electron renderer.I mouted file system with NODEFS, and call clone command . However, I got the following error:

图片

Here is the code in the worker script:

FS.mkdir('/working');
FS.mount(NODEFS, { root: '/User/xxxx/.config/my-app' }, '/working');
FS.chdir('/working');
lg.callMain([
    'clone',
    `https://github.com/petersalomonsen/wasm-git.git`,
    'workingTree',
]);

Did I miss something? In fact, .git is created in physical file system, but not the files in working tree.

图片
petersalomonsen commented 3 years ago

seems like a bug has been introduced here. just tried with version 0.0.2 here: https://unpkg.com/browse/wasm-git@0.0.2/ where it works for me, but with 0.0.4 it fails. Will try to figure out what has happened here. thanks for reporting :)

petersalomonsen commented 3 years ago

Actually it seems that 0.0.4 was built without the last two lines (replacement from 0444 to 0644) in setup.sh.

Would you try the version in the attached file?

wasmgit.zip

ylc395 commented 3 years ago

Wow, it works now 👍. Maybe we can realease it as 0.0.5?

petersalomonsen commented 3 years ago

released 0.0.5, should be ok now :)

petersalomonsen commented 3 years ago

actually use 0.0.6.. 0.0.5 was built in debug mode and is not optimized for size.