Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use in Deno? #78

Open
yardenshoham opened this issue May 10, 2023 · 3 comments
Open

How to use in Deno? #78

yardenshoham opened this issue May 10, 2023 · 3 comments

Comments

@yardenshoham
Copy link

I tried:

// debug.ts
import lg from "npm:wasm-git/lg2.js";

lg.onRuntimeInitialized = () => {
  const FS = lg.FS;
  const MEMFS = FS.filesystems.MEMFS;

  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 repository from github
  lg.callMain([
    "clone",
    "https://github.com/torch2424/made-with-webassembly.git",
    "clonedtest",
  ]);

  FS.chdir("clonedtest");
  console.log(FS.readdir("."));
  lg.callMain(["log"]);
};

It outputs an error:

$ time deno run -A debug.ts
[ ".", "..", ".git" ]
Could not find repository HEAD [-1] - reference 'refs/heads/master' not found

real    0m0.093s
user    0m0.130s
sys     0m0.073s
@petersalomonsen
Copy link
Owner

I have never tested with deno. What is the difference if you run a similar script in nodejs?

@yardenshoham
Copy link
Author

A similar script works perfectly in nodejs. Do you plan to support deno or should I close this issue?

@petersalomonsen
Copy link
Owner

No you can leave it open. I will try to look into this at some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants