git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: 'git gc' & number of unpacked objects ?

From
Sam Vilain <sam@vilain.net>
Date
Jul 17, 2007, 20:57 UTC
Message-ID
<469D2D4B.8090900@vilain.net>
In-Reply-To
<f36b08ee0707170914g7ece7124qf5d8d6a1307cc07e@mail.gmail.com>
Yakov Lerner wrote:
Show 11 quoted lines
> By the analogy with the maxtime and maxmount in the ext3 when it
> reminds you to fsck, when number of mounts since last fsck, or time since
> last fsck is above some limits. I think this makes practical sense. I
> think
> the similar thing makes sense wrt to 'git gc'.
>
> Is it possible that git repo had a parameter N, and when the counter of
> unpacked object hit this number,  then git operations start to print
> semi-annoying warnings
>      "Time to optimize your repo using 'git gc' command ... "
> ?

I also wrote a commit hook that counts loose objects and just runs repack with differing parameters. Check for threads with terms "generational repack" in them.

To make it a really fast check, Linus suggested estimating the number of loose objects with a sample, eg if the threshold is 256 loose objects and you find 3 or more objects in directories 01, 02, and 03 then it's time to repack.

I've been using the script I posted on my own repositories for a while and was never really annoyed by the 2-3s aside it took every few dozen commits to repack. But then I'm probably biased and usually playing on relatively zippy machines.

Sam.
Previous: Yakov Lerner
Message 2 of 2 in “'git gc' & number of unpacked objects ?”
  1. Yakov LernerJul 17, 2007
  2. Sam VilainJul 17, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.