src-d / go-git

Project has been moved to: https://github.com/go-git/go-git
https://github.com/go-git/go-git
Apache License 2.0
4.91k stars 541 forks source link

Filesystem storage issue: reference delta not found. #1218

Open kaypour opened 4 years ago

kaypour commented 4 years ago

I made a quick HTTP frontend to play with the code you have here: https://github.com/src-d/go-git/blob/master/plumbing/transport/server/server.go

Providing the constructor a filesystem.Storage causes me to get reference delta not found when I do subsequent pushes to a repository, which was pushed from somewhere else, into the server. I cannot seem to reproduce this issue when using the memory.Storage.

Reproducing: Paste this intendedly minimal Git server into somewhere you can run it: https://play.golang.org/p/j2AKA1dJb4A

Once the server is running: git clone https://github.com/src-d/go-git && cd go-git git remote set-url origin http://127.0.0.1:11000/hello_world.git git push --set-upstream origin master <- This will work. echo 'hello_world' >> quickfile.txt && git add . && git commit -m "my test commit" git push <- reference delta not found

Now try with the memory storage. go back to the source and comment out the filesystem storage and undo the comment for the memory storage (should be from line 23 to 25) run the server again. You don't need to reclone the repo, just reuse the same. git push <- This will work. echo 'hello_world' >> quickfile2.txt && git add . && git commit -m "my test commit 2" git push <- This will work as well.

Is the filesystem storage not supposed to be used for a Git server?

ybkimm commented 4 years ago

I commented out this function and it works fine.

https://github.com/src-d/go-git/blob/8d20cc5916edf7cfa6a9c5ed069f0640dc823c12/storage/filesystem/object.go#L96-L114