forked from petersalomonsen/wasm-git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_webworker.js
41 lines (26 loc) · 969 Bytes
/
example_webworker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
importScripts('lg2.js');
Module.onRuntimeInitialized = () => {
const lg = Module;
FS.mkdir('/working');
FS.mount(MEMFS, { }, '/working');
FS.chdir('/working');
FS.writeFile('/home/web_user/.gitconfig', '[user]\n' +
'name = Test User\n' +
'email = [email protected]');
// clone a local git repository and make some commits
lg.callMain(['clone','http://localhost:5000/test', 'testrepo']);
FS.chdir('testrepo');
FS.writeFile('test.txt', 'hello');
lg.callMain(['add', '--verbose', 'test.txt']);
lg.callMain(['commit','-m','test 123']);
lg.callMain(['log']);
lg.callMain(['status']);
lg.callMain(['status']);
FS.writeFile('test.txt', 'second revision');
lg.callMain(['add', 'test.txt']);
lg.callMain(['status']);
lg.callMain(['commit','-m','test again']);
lg.callMain(['status']);
lg.callMain(['log']);
lg.callMain(['push']);
};