Skip to content

Commit 879e80e

Browse files
committed
failing init
1 parent 90eab11 commit 879e80e

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

emscriptenbuild/build.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ elif [ "$1" == "Debug-async" ]; then
2828
POST_JS="--post-js $(pwd)/post-async.js"
2929
fi
3030

31-
# Before building, remove any ../libgit2/src/transports/emscriptenhttp.c left from running setup.sh
31+
# Before building, remove any ../libgit2/src/transports/emscriptenhttp.c left from running setup.sh
3232
[ -f "../libgit2/src/libgit2/transports/emscriptenhttp-async.c" ] && rm ../libgit2/src/libgit2/transports/emscriptenhttp-async.c
3333

34-
emcmake cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_FLAGS="$EXTRA_CMAKE_C_FLAGS --pre-js $(pwd)/pre.js $POST_JS -s \"EXTRA_EXPORTED_RUNTIME_METHODS=['FS','callMain']\" -lnodefs.js -lidbfs.js -s INVOKE_RUN=0 -s ALLOW_MEMORY_GROWTH=1 -s STACK_SIZE=131072" -DREGEX_BACKEND=regcomp -DSONAME=OFF -DUSE_HTTPS=OFF -DBUILD_SHARED_LIBS=OFF -DTHREADSAFE=OFF -DUSE_SSH=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=ON ../libgit2
34+
emcmake cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_FLAGS="$EXTRA_CMAKE_C_FLAGS \
35+
--pre-js $(pwd)/pre.js $POST_JS -sEXPORTED_FUNCTIONS=['_my_sqrt','_main','_malloc','_git_repository_open_ext','_git_repository_init'] -s \"EXTRA_EXPORTED_RUNTIME_METHODS=['FS','callMain','ccall','cwrap']\" -lnodefs.js -lidbfs.js -s INVOKE_RUN=0 -s ALLOW_MEMORY_GROWTH=1 -s STACK_SIZE=131072" -DREGEX_BACKEND=regcomp -DSONAME=OFF -DUSE_HTTPS=OFF -DBUILD_SHARED_LIBS=OFF -DTHREADSAFE=OFF -DUSE_SSH=OFF -DBUILD_CLAR=OFF -DBUILD_EXAMPLES=ON ../libgit2
3536
emmake make lg2

examples/example_webworker_init.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
importScripts('lg2.js');
2+
3+
Module.onRuntimeInitialized = () => {
4+
5+
FS.mkdir('/working');
6+
FS.mount(MEMFS, { }, '/working');
7+
8+
FS.writeFile('/home/web_user/.gitconfig', '[user]\n' +
9+
'name = Test User\n' +
10+
'email = [email protected]');
11+
12+
// Allocate memory of 8 bytes for pointer (probably 4 would be enough)
13+
let repoPointer = Module._malloc(8);
14+
15+
// int git_repository_init(git_repository **out, const char *path, unsigned int is_bare);
16+
let git_repository_init = Module.cwrap('git_repository_init', 'number', ['number','string','number'])
17+
18+
let r1 = git_repository_init(repoPointer, "/working", 0)
19+
console.log(`r1 ${r1}`);
20+
21+
};

0 commit comments

Comments
 (0)