Blobs not referenced by file (anymore) are not removed by GC
- From
- Martin Scherer <m.scherer@fu-berlin.de>
- Date
- Dec 8, 2014, 16:22 UTC
- Message-ID
- <5485D03F.3060008@fu-berlin.de>
Hi,
after using BFG on a repo given certain directory globs, all of those files(names) are gone from history, but can not be collected by garbage collection anymore. So the blobs of the underlying files are not deleted and only the file names are not associated with the blob anymore. I wonder, if I discovered a bug (at least in bfg). But I expect git to discover that this blobs are not used in any way (so they have to associated to something right?)
# invoke bfg --delete-folders something multiple times with different pattern.
# try to cleanup
git gc --aggressive --prune=now # big blobs still in history git fsck # no results git fsck --full --unreachable --dangling # no results
to verify if the blobs are still there, see the output of
git gc && git verify-pack -v .git/objects/pack/pack-*.idx | egrep "^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$" | sort -k 3 -n -r > bigobjects .txt
head bigobjects.txt # outputs 9451427d7335395779b91864418630d2f0af780a blob 7895212 1869047 7657491
Also if bfg is being told to remove the biggest blob (bfg -B 1) with no-blob-protection, it does not succeed in removing it.
--- output of bfg -B 1
Found 1 blob ids for large blobs - biggest=7895212 smallest=7895212 ....
BFG aborting: No refs to update - no dirty commits found?? ---
The repo can be found here.
https://github.com/marscher/stallone_stale_objects
I will restart all over to cleanup the history, but I guess this might be interesting for git developers.
Best, Martin