From: Johannes Sixt <j6t@kdbg.org>
To: "Michal Suchánek" <msuchanek@suse.de>
Cc: Git List <git@vger.kernel.org>, Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: git gc ineffective
Date: Thu, 7 Jan 2021 22:48:54 +0100 [thread overview]
Message-ID: <07798280-9818-0d21-5c63-dfc1c621082a@kdbg.org> (raw)
In-Reply-To: <20210107183531.GB6564@kitsune.suse.cz>
Am 07.01.21 um 19:35 schrieb Michal Suchánek:
> Hello,
>
> On Mon, Nov 09, 2020 at 12:17:57PM +0100, Andreas Schwab wrote:
>> On Nov 09 2020, Michal Suchánek wrote:
>>
>>> On Mon, Nov 09, 2020 at 11:17:38AM +0100, Michal Suchánek wrote:
>>>> On Mon, Nov 09, 2020 at 10:49:21AM +0100, Andreas Schwab wrote:
>>>>> On Nov 09 2020, Michal Suchánek wrote:
>>>>>
>>>>>> I noticed I am running out of disk space, and one repository taking up
>>>>>> about 38G. Did git gc --aggressive, and the used space *raised* to 42G,
>>>>>> and git would report it does gc after every commit.
>>>>>
>>>>> Do you have a lot of loose objects?
>>>> { for i in .git/objects/?? ; do ls $i ; done ; } | wc -l
>>>> 53392
>>> And in the double-size repository it's doubled, too:
>>> { for i in .git/objects/?? ; do ls $i ; done ; } | wc -l
>>> 101167
>>
>> git count-objects also shows the size.
> $ git count-objects
> 59853 objects, 43249880 kilobytes
> $ du -hs .git
> 48G .git
> $ git gc --aggressive
> Enumerating objects: 1825080, done.
> Counting objects: 100% (1825080/1825080), done.
> Delta compression using up to 4 threads
> Compressing objects: 100% (1803925/1803925), done.
> Writing objects: 100% (1825080/1825080), done.
> Total 1825080 (delta 1234005), reused 587969 (delta 0), pack-reused 0
> Removing duplicate objects: 100% (256/256), done.
> Checking connectivity: 2003814, done.
> Expanding reachable commits in commit graph: 337512, done.
> $ du -hs .git
> 172G .git
> $ git count-objects
> 178734 objects, 175309572 kilobytes
>
>> Does it help to prune them --exprire now?
>
> $ git prune
> Checking connectivity: 1825478, done.
> $ du -hs .git
> 3.9G .git
> $ git --version
> git version 2.26.2
>
> So it is my wrong expectation that 'gc' comand removes garbage. It
> creates it en masse.
>
> It just makes is in a way that the 'prune' command that really reoves
> garbage can now remove it.
It's an unfortunate default behavior of `git gc`. Set gc.pruneExpire to
'now' to countermand it, but watch out for the caveats.
See
https://stackoverflow.com/questions/55414916/how-to-avoid-that-git-gc-generates-garbage-loose-objects
for more details.
-- Hannes
prev parent reply other threads:[~2021-01-07 21:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-09 9:20 git gc ineffective Michal Suchánek
2020-11-09 9:49 ` Andreas Schwab
2020-11-09 10:17 ` Michal Suchánek
2020-11-09 10:43 ` Michal Suchánek
2020-11-09 10:48 ` Michal Suchánek
2020-11-09 11:17 ` Andreas Schwab
2021-01-07 18:35 ` Michal Suchánek
2021-01-07 21:48 ` Johannes Sixt [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=07798280-9818-0d21-5c63-dfc1c621082a@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=msuchanek@suse.de \
--cc=schwab@linux-m68k.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).