{"thread":{"id":"20830","subject":"Hosting Git repositories: how useful will git-gc be?","startedAt":"2009-09-03T09:45:25Z","lastAt":"2009-09-05T06:24:24Z","messageCount":2,"participants":["Matthieu Moy","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"122345","messageId":"vpq1vmo9xai.fsf@bauges.imag.fr","threadId":"20830","inReplyTo":null,"subject":"Hosting Git repositories: how useful will git-gc be?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2009-09-03T09:45:25Z","receivedAt":"2009-09-03T09:45:25Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Hi,\n\nI'm helping my sysadmin to set up some Git repository hosting via\ngitosis. I'm trying to keep it as simple as possible.\n\nA question: is it necessary/recommanded/useless to set up a cron job\ndoing a \"git gc\" in each repository? My understanding is that a push\nthrough ssh will do some packing, is it correct? Does receiving a pack\ntrigger a \"git gc --auto\"?\n\nThanks,\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"122483","messageId":"20090905062424.GC29863@coredump.intra.peff.net","threadId":"20830","inReplyTo":"vpq1vmo9xai.fsf@bauges.imag.fr","subject":"Re: Hosting Git repositories: how useful will git-gc be?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-09-05T06:24:24Z","receivedAt":"2009-09-05T06:24:24Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Sep 03, 2009 at 11:45:25AM +0200, Matthieu Moy wrote:\n\n> A question: is it necessary/recommanded/useless to set up a cron job\n> doing a \"git gc\" in each repository? My understanding is that a push\n> through ssh will do some packing, is it correct? Does receiving a pack\n> trigger a \"git gc --auto\"?\n\nThe objects are transferred as a pack. If the number of objects is less\nthan receive.unpackLimit (default 100), then they are unpacked to loose\nobjects. If more, we keep the pack, after completing any missing deltas\nused by a thin pack.\n\nSo if you tend to push frequently, you will end up with a lot of loose\nobjects. Even if you have packs, they will be larger than necessary\nbecause you will be missing deltas between objects across packs. And of\ncourse you will eventually end up with a large number of packs, which is\nless efficient (each pack has an index, but I believe we search the\nindices linearly).\n\nReceiving a pack does not (AFAICT looking at the code) trigger a \"gc\n--auto\".  Running it has other benefits, too, like pruning cruft and\npacking refs. So I think it is probably a good idea to run it\nperiodically.\n\nRunning it daily or weekly is probably reasonable. You could run it on\nevery push using the post-update hook, but that may cause excessive I/O\nfor very little benefit.\n\n-Peff\n"}]}