From: Lars Schneider <larsxschneider@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: "There are too many unreachable loose objects" - why don't we run 'git prune' automatically?
Date: Fri, 9 Jun 2017 14:03:18 +0200 [thread overview]
Message-ID: <7497DFA7-3F4E-4DB2-B31B-FDDEB2F30BB8@gmail.com> (raw)
In-Reply-To: <20170609052755.dsuqd4gizi2opoya@sigill.intra.peff.net>
> On 09 Jun 2017, at 07:27, Jeff King <peff@peff.net> wrote:
>
> On Thu, Jun 08, 2017 at 02:45:48PM +0200, Lars Schneider wrote:
>
>> I recently ran into "There are too many unreachable loose objects; run
>> 'git prune' to remove them." after a "Auto packing the repository in
>> background for optimum performance." message.
>>
>> This was introduced with a087cc9 "git-gc --auto: protect ourselves from
>> accumulated cruft" but I don't understand the commit message really.
>>
>> Why don't we call 'git prune' automatically? I though Git would prune
>> unreachable objects after 90 days by default anyways. Is the warning
>> about unreachable objects that are not yet 90 days old?
>
> We _do_ call "git prune", but we do so with whatever configured
> expiration time is (by default 2 weeks; the 90-day expiration is for
> reflogs).
>
> The problem is that auto-gc kicked in because there were a bunch of
> loose objects, but after repacking and running "git prune" there were
> still enough loose objects to trigger auto-gc. Which means every command
> you run will do an auto-gc that never actually helps.
>
> So you have two options:
>
> 1. Wait until those objects expire (which may be up to 2 weeks,
> depending on how recent they are), at which point your auto-gc will
> finally delete them.
>
> 2. Run "git prune". Without an argument it prunes everything now,
> with no expiration period.
>
> I agree the existing message isn't great. There should probably be a big
> advise() block explaining what's going on (and that expert users can
> disable).
How about this?
diff --git a/builtin/gc.c b/builtin/gc.c
index c2c61a57bb..12ee212544 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -473,9 +473,18 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
if (pack_garbage.nr > 0)
clean_pack_garbage();
- if (auto_gc && too_many_loose_objects())
- warning(_("There are too many unreachable loose objects; "
- "run 'git prune' to remove them."));
+ if (auto_gc && too_many_loose_objects()) {
+ warning(_("Auto packing did not lead to optimal results as the "
+ "repository contains too many unreachable objects."));
+ advice(_("Unreachable objects are Git objects (commits, files, ...) "
+ "that are not referenced by any branch or tag. This might happen "
+ "if you use 'git rebase' or if you delete branches. Auto packing "
+ "only prunes unreachable objects that are older than 2 weeks "
+ "(default, overridable by the config variable 'gc.pruneExpire'). "
+ "Please run 'git prune' to prune all unreachable objects for "
+ "optimal repository performance."));
+ }
if (!daemonized)
unlink(git_path("gc.log"));
- Lars
next prev parent reply other threads:[~2017-06-09 12:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 12:45 "There are too many unreachable loose objects" - why don't we run 'git prune' automatically? Lars Schneider
2017-06-09 5:27 ` Jeff King
2017-06-09 12:03 ` Lars Schneider [this message]
2017-06-10 8:06 ` Jeff King
2017-06-18 13:22 ` Lars Schneider
2017-06-20 14:08 ` Jeff King
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=7497DFA7-3F4E-4DB2-B31B-FDDEB2F30BB8@gmail.com \
--to=larsxschneider@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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).