libgit.Clone produces empty directory, fails with `failed to stat path/to/repo/.git`
juanique opened this issue · 1 comments
juanique commented
I'm doing this:
if libgit.Features()&libgit.FeatureSSH != 0 {
fmt.Println("libgit2 has SSH support!")
} else {
fmt.Println("libgit2 does not have SSH support.")
}
repo, err := libgit.Clone(repoURL, localPath, &libgit.CloneOptions{})
if err != nil {
return nil, fmt.Errorf("error cloning repository %s to %s: %w", repoURL, localPath, err)
}
defer repo.Free()
The code fails with:
libgit2 has SSH support!
error cloning repository git@github.com/juanique/bazel-examples.git to /home/juanique/ggo/bazel-examples: failed to stat '/home/juanique/ggo/bazel-examples/.git':
I see that the directory /home/juanique/ggo/bazel-examples
was created and it's empty.
I don't know if it is relevant but I'm running Ubuntu with WSL2 on Windows and building my go binary using bazel with cgo for the libgit2 dependency.
I'm using git2go@v33
juanique commented
It turns out the issue is because I'm using the zig
C toolchain and I'm hitting this bug: ziglang/zig#11878