Skip to content

Instantly share code, notes, and snippets.

@herrozerro
Created May 8, 2020 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herrozerro/bf048b0f14445e2c6eb60fe9026ca04b to your computer and use it in GitHub Desktop.
Save herrozerro/bf048b0f14445e2c6eb60fe9026ca04b to your computer and use it in GitHub Desktop.
var Module = {
locateFile: function (s) {
return './lib/wasm-git/' + s;
}
};
importScripts('./lib/wasm-git/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 = test@example.com');
// clone a local git repository and make some commits
lg.callMain(['clone', `https://github.com/herrozerro/WritingGit.git`, 'testrepo']);
FS.readdir('testrepo');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment