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

go-git returns PackFileNotFound, but git does not report a Problem #1223

Open pampersrocker opened 4 years ago

pampersrocker commented 4 years ago

In go-gitea/gitea#8330 we encountered a problem where go-git is returning a PackFileNotFoundError on a otherwise perfectly normal git repository (as described in the original issue, git is not reporting any error with git fsck or git fsck --full and a git repack does not resolve the problem either.

A single sommit in the repository seems to cause the problem. However the project in which this occurs is confidential so I cannot share the full repository for analysis, but if you can guide me how I may retrieve additional information which may be useful for further analysis of this commit, I can see what I can do.

Maybe @robertschulze or @smile34 can provide infos as well.

filipnavara commented 4 years ago

Can you please provide listing of the .git/objects/packs/ directory? Is there a objects/info/packs file in the repository? If yes, can you share it please?

pampersrocker commented 4 years ago

The following packsDirContents.txt is the output of ls -la of the .git/objects/packs/ dir, the pack.txt is the objects/info/packs file, just with .txt added as GitHub does not allow empty file extensions.

packsDirContents.txt

pack.txt

pampersrocker commented 4 years ago

Looking at the other comments, indeed a complete run of git gc fixes the problem as it removes any .tmp and packs everything into a single pack file.