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

Re: git repack vs git gc --aggressive

From
FNFelix Natter <fnatter@gmx.net>
Date
Aug 10, 2012, 19:09 UTC
Message-ID
<87ehnewolp.fsf@bitburger.home.felix>
In-Reply-To
<7vvcguv7y2.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 31 quoted lines
> Jeff King <peff@peff.net> writes:
>
>> So the packing parameters are the same these days for either method.
>> Note that "git gc --aggressive" will also use "-f" to recompute all
>> deltas. This is more expensive, but gives git more flexibility if the
>> old deltas were sub-optimal (typically, this is the case if the existing
>> pack was generated by fast-import, which favors speed of import versus
>> coming up with an optimal storage pattern).
>
> Also your fetch often results in storing the pack received from the
> other end straight to your local repository (with necessary objects
> to complete the pack the other end did not send appended at the
> end).  If the server side hasn't been packed with "-f", you will
> inherit the badness until you repack with "-f".
>
>> Of course, every workload is different. One can develop pathological
>> cases where --depth=500 saves a lot of space. But it's unlikely that it
>> is the case for a normal repository. You can always try both and see the
>> result.
>
> For a dataset where ridiculously large depth really is a win, these
> objects would have to be reasonably large and cost of expanding the
> base and then applying hundreds of delta to recover one object may
> not be negligible. The user should consider if he is willing to pay
> the price every time he does a local Git operation.
>
>> In fact, I'd also test how just "git gc" behaves versus "git gc
>> --aggressive" for your repo. The former is much less expensive to run.
>> You really shouldn't need to be running "--aggressive" all the time, so
>> if you are looking at doing a nightly repack or similar, just "git gc"
>> is probably fine.
Thank you both very much for your answers!
I have a few questions about this:
Show 5 quoted lines
> As I am coming from "large depth is harmful" school, I would
> recommend
>
>  - "git repack -a -d -f" with large "--window" with reasonably short
>    "--depth" once, 
So something like --depth=250 and --window=500? 
> and mark the result with .keep;
I guess you refer to a toplevel '.keep' file. But what does
that do (sorry, couldn't find anything on google)?
  
Show 5 quoted lines
>  - "git repack -a -d -f" once every several weeks; and
>
>  - "git gc" or "git repack" (without any other options) daily.
>
> and ignore "--aggressive" entirely.

One more question: I use bzr fast-export | git fast-import to import branches from bzr:

    bzr fast-export --marks=$MARKS_BZR --git-branch="$BRANCHNAME" "$BZR_FREEPLANE_REPO/$BRANCHNAME/" | \
        git fast-import --import-marks=$MARKS_GIT --export-marks=$MARKS_GIT

Will those marks files (which remember which commits are already there in the git repo) also work after I have done git repack / git gc? In other words, can I import bzr-branches after I have run git repack / git gc on the repo?

Thank you!
-- 
Felix Natter
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 7 in “git repack vs git gc --aggressive”
  1. Felix NatterAug 7, 2012
  2. Jeff KingAug 7, 2012
  3. Junio C HamanoAug 7, 2012
  4. Felix NatterAug 10, 2012
  5. Junio C HamanoAug 10, 2012
  6. Marc BranchaudAug 13, 2012
  7. Junio C HamanoAug 13, 2012

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.