Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does git gc execute at deterministic intervals?

I've been reading up on git, and I have a very particular question I am struggling to answer.

When does git gc execute autonomously?

I've been hearing through the grape-vine of various forums that it occurs by default on a push or a fetch/pull - but I cannot find any source that verifies this. Even the documentation itself only gets this specific (emphasis mine):

Some git commands may automatically run git gc; see the --auto flag below for details

and the --auto flag specifies

Some git commands run git gc --auto after performing operations that could create many loose objects.

I want to be able to deterministically say:

"Loose tree and blob files will not have been cleaned up by git until one of the following commands is run: {mystery list here}. When running one of these commands, if the number of loose objects exceeds the value of gc.auto, git will automatically compress the objects into a packfile".

like image 362
Matt Avatar asked Oct 13 '16 15:10

Matt


1 Answers

Currently those are:

  • fetch
  • merge
  • am
  • receive-pack
  • commit (starting with Git 2.17, Q2 2018)

Actual list can be verified by doing a code search.

Also from that you can see that gc on receive can be disabled with receive.autogc, others just run the gc in the end.

like image 111
Ivan Avatar answered Sep 19 '22 10:09

Ivan