-
Notifications
You must be signed in to change notification settings - Fork 534
Connection closed and repo files gone #1033
Comments
For future references or for others having the same issue I got it working by using Clone not PlainClone and memory storer. // Filesystem abstraction based on memory
fs := memfs.New()
// Git objects storer based on memory
storer := memory.NewStorage()
repo, err := git.Clone(storer, fs, &git.CloneOptions{
URL: repoUrl,
Depth: 200,
Progress: os.Stdout,
ReferenceName: plumbing.ReferenceName("refs/heads/master"),
SingleBranch: true,
Tags: git.NoTags,
}) In any case I would expect PlainClone to work. |
@kainlite Indeed, cleanup on PlainClone errors is a behavior we introduced in go-git v4.8.0 (#741) to better match git's behavior for clone. I'm not sure what's git behavior if the connection closes half-way during a clone though. Is the repository you're getting after the closed connection error valid? Or is it corrupted? Because probably the problem we should try to solve is the network error, not the cleanup... |
The files get removed right away, so I didn't had a chance to look at the repo state after the connection error, interestingly enough with Clone I didn't had that problem at all. Also it only happened with one big repo, I tried with other smaller repos and everything was working fine. |
@kainlite Did you try your working Clone approach without |
@smola Yes, I started with the most basic approach, only the repo, then started adding parameters but there was no difference, my first attempt was something like this: repo, err := git.PlainClone(directory, false, &git.CloneOptions{
URL: repoUrl,
Progress: os.Stdout,
}) |
@kainlite I mean with |
Yes, the repo looks fine with |
Thanks @kainlite, we'll look into the issue. |
Hi. I have the same bug only for big repositories. Do you have any solutions for fixing it? |
I've tested downloading a Linux kernel and works fine with |
Nice research, seems you're right |
I managed to replicate exact same issue where cloning of medium sized repository (70 megs) works fine with |
Hi,
I've been trying to clone a bitbucket repo and I've hit a few issues, first of all it closes the connection and deletes all local files, I've tried different options for CloneOptions with no change at all, like SingleBranch: true, or Tags: git.NoTags,
I don't have a public repo to reproduce the issue, but it also does not happen with other repos that I'm using, is there something I can do or check to make this work?
Thanks.
The text was updated successfully, but these errors were encountered: