after many pushes, there many files under myproj.git/objects
There won't be as much with git 2.11+ (Q4 2016) and a pre-receive hook.
In that scenario, you won't have to trigger a git gc
at all.
See commit 62fe0eb, commit e34c2e0, commit 722ff7f, commit 2564d99, commit 526f108 (03 Oct 2016) by Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit 25ab004, 17 Oct 2016)
receive-pack
: quarantine objects until pre-receive accepts
In order for the receiving end of "git push" to inspect the received history and decide to reject the push, the objects sent from the sending end need to be made available to the hook and the mechanism for the connectivity check, and this was done traditionally by storing the objects in the receiving repository and letting "git gc
" to expire it.
Instead, store the newly received objects in a temporary area, and make them available by reusing the alternate object store mechanism to them only while we
decide if we accept the check, and once we decide, either migrate them to the repository or purge them immediately.
That temporary area will be set by the new environment variable GIT_QUARANTINE_ENVIRONMENT
.
That way, if a (big) push is rejected by a pre-receive
hook, those big objects won't be laying around for 90 days waiting for git gc
to clean them up.