git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Andreas Krey <a.krey@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: Big repo not shrinking on repack or gc?
Date: Wed, 14 Jan 2015 07:49:36 -0500	[thread overview]
Message-ID: <20150114124936.GC30383@peff.net> (raw)
In-Reply-To: <20150114115130.GA5677@inner.h.apk.li>

On Wed, Jan 14, 2015 at 12:51:30PM +0100, Andreas Krey wrote:

> I have a repo here that is 130G, but when I clone --mirror it, the result
> is only 25G big.  Because of the --mirror I don't think that I missed
> any refs that keep objects only in the source repo.

Perhaps some objects are mentioned by reflogs, but not by the refs? They
would not be transferred as part of a clone. Try:

  git rev-list --objects --all | cut -d' ' -f1 | sort >reachable
  git rev-list --objects --reflog | cut -d' ' -f1 | sort >reflogs
  comm -13 reachable reflogs |
  git cat-file --batch-check='%(objectsize:disk)' |
  perl -lne '$total += $_; END { print $total }'

That should print the size, in bytes, that reflog-only objects are using
on disk.  You can use "git reflog expire --expire-unreachable=now --all"
to get rid of them (and then repack).

> I already tried 'git repack -fad' and 'git gc' to shrink the original repo,

You don't need the "-f" here. Just "git repack -ad" should be enough
(and the "-f" probably makes it _way_ slower).

-Peff

  reply	other threads:[~2015-01-14 12:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 11:51 Big repo not shrinking on repack or gc? Andreas Krey
2015-01-14 12:49 ` Jeff King [this message]
2015-01-14 13:07   ` Andreas Krey
2015-01-14 14:39   ` Andreas Krey
2015-01-14 16:00     ` Andreas Krey
2015-01-14 17:24     ` Junio C Hamano
2015-01-15  1:23       ` Bryan Turner
2015-01-15  6:38         ` Andreas Krey
2015-01-15  7:05           ` Bryan Turner
2015-01-15  7:43             ` Andreas Krey
2015-01-15  8:56               ` Bryan Turner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150114124936.GC30383@peff.net \
    --to=peff@peff.net \
    --cc=a.krey@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).