This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Remote.Push pushes corrupted objects to the server #840
Closed
Description
Related to src-d/borges#264
Remote.Push
pushes some corrupted objects to the server, so the repo becomes unreadable. This happens at least with https://github.com/zfcampus/zf-oauth2. We're aware of a lot more repos with this issue, but this was the first I could get my hands on.
The error:
[2858] error: delta replay has gone wild
[2858] fatal: pack has bad object at offset 470810: failed to apply delta
Reproduction
Setup the server:
mkdir /tmp/server-repo
cd /tmp/server-repo
git --bare init --shared
git daemon --verbose --base-path=/tmp --export-all --reuseaddr --enable=receive-pack
Push with go-git:
package main
import (
"log"
git "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/config"
)
func main() {
r, err := git.PlainClone("/tmp/client-repo", false, &git.CloneOptions{
URL: "https://github.com/zfcampus/zf-oauth2",
})
assert(err)
err = r.Fetch(&git.FetchOptions{
RefSpecs: []config.RefSpec{
"refs/*:refs/*",
"HEAD:refs/heads/HEAD",
},
})
assert(err)
remote, err := r.CreateRemote(&config.RemoteConfig{
Name: "external",
URLs: []string{"git://localhost/server-repo"},
})
assert(err)
err = remote.Push(&git.PushOptions{
RemoteName: "external",
RefSpecs: []config.RefSpec{
"refs/*:refs/*",
"HEAD:refs/heads/HEAD",
},
})
assert(err)
}
func assert(err error) {
if err != nil {
log.Fatal(err)
}
}
Doing the same operation with git push
does not result in any corrupted object.
I've checked and the repo is not corrupted neither before pushing nor afterwards, the problem only occurs pushing.
I'm currently trying to trace where the issue is.
UPDATE: setting config.Pack.Window
to 0 makes the issue go away, but that turns off delta compression, though.