I would like to measure / count objects in git to see whether I am close to auto-packing, I think it can be done trivially by counting files in .git/objects/..., but I am not sure.
Here is the story:
For a couple of days now, my git repo is auto-packing itself whenever I push to it. (The git repo lives on a USB memory stick, therefore the auto-packing is awfully slow and I have cancel it after 30 minutes or so)
it is the same problem as:
What does "Auto packing the repository for optimum performance" mean?
I'm having a problem with my git repo. For the last couple of days whenever I do a push to the server I get this message: "Auto packing the repository for optimum performance"
In that same thread I found the solution:
To disable for one project:
cd your_project_dir
git config gc.auto 0
To disable globally:
git config --global gc.auto 0
That solved my problem for that particular repo...
...but I have got many more git repo's on my memory stick and I would like to know a way to measure if any of my other git repos is close to auto-packing
I found:
Why does git run auto-packing on every push to our repo?
Git decides whether to auto gc based on two criteria:
Are there too many packs? (Literally, are there more than 50 files with .idx in .git/objects/pack?)
Are there too many loose objects? (Literally, are there more than 27 files in .git/objects/17?)
My question is almost answered, but I would simply like to have confirmation that I understand correctly: How can I measure / count loose objects to see if I am close to auto-packing ? -- is it (as suggested in the above answer) literally counting files in .git/objects/17 and compare to the hard limit of 27,
-- or maybe it is counting all files in .git/objects/01, .../02, .../03, etc... and comparing the average to a soft limit defined in git config global ?
-- even if it is trivial, is there a git command that counts objects in .git/objects/17 ? -- is there a git command that returns the hard limit of 27 ?