Open hairyhenderson opened 4 years ago
I've had some partial success on this. I'd missed the server.NewFilesystemLoader
function, and I'm having some success with:
fs := memfs.New()
l := server.NewFilesystemLoader(fs)
c := server.NewClient(l)
client.InstallProtocol("mem", c)
I'll follow up if I have issues, but I think it'd still be useful to call this out in the examples since this can be a useful pattern especially in testing...
I'm wondering there's any way to clone from a repo stored in an in-memory filesystem?
I have a use-case where I need to clone a repo from a filesystem into memory so that I can work with it there. I can't read directly from the actual on-disk repo because I don't want to pick up local changes or affect the state of the local repo.
From reading the code my impression is that this isn't possible, but that I may be able to implement something with
client.InstallProtocol
. I was hoping to piggyback on theplumbing/transport/file
code, but it seems that just execs out to thegit-upload-pack
git-receive-pack
binaries, which won't help at all 😂Has this been done before? Am I missing something obvious?