From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 8/8] git-gc --auto: run "repack -A -d -l" as necessary.
Date: Mon, 17 Sep 2007 10:53:37 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0709171044170.28586@racer.site> (raw)
In-Reply-To: <1190018716666-git-send-email-gitster@pobox.com>
Hi,
On Mon, 17 Sep 2007, Junio C Hamano wrote:
> diff --git a/builtin-gc.c b/builtin-gc.c
> index 34ce35b..a82f6be 100644
> --- a/builtin-gc.c
> +++ b/builtin-gc.c
> @@ -78,6 +83,9 @@ static int too_many_loose_objects(void)
> int num_loose = 0;
> int needed = 0;
>
> + if (gc_auto_threshold <= 0)
> + return 0;
> +
Heh, patch 6/8 explicitely moved this check out of the function.
> @@ -100,21 +108,58 @@ static int too_many_loose_objects(void)
> return needed;
> }
>
> +static int too_many_packs(void)
> +{
> + struct packed_git *p;
> + int cnt;
> +
> + if (gc_auto_pack_limit <= 0)
> + return 0;
> +
> + for (cnt = 0, p = packed_git; p; p = p->next) {
> + char *suffix;
> + int keep;
> + if (!p->pack_local)
> + continue;
> + suffix = p->pack_name + strlen(p->pack_name) - 5;
I suspect that you need something like
int len;
len = strlen(p->pack_name);
if (len < 5)
continue;
before this.
> + if (memcmp(suffix, ".pack", 6))
> + continue;
> + memcpy(suffix, ".keep", 6);
> + keep = access(p->pack_name, F_OK) && (errno == ENOENT);
> + memcpy(suffix, ".pack", 6);
Heh. Took me some looking around to see why this is allowed...
> static int need_to_gc(void)
> {
> int ac = 0;
>
> /*
> - * Setting gc.auto to 0 or negative can disable the
> - * automatic gc
> + * Setting gc.auto and gc.autopacklimit to 0 or negative can
> + * disable the automatic gc.
> */
> - if (gc_auto_threshold <= 0)
> - return 0;
> -
> - if (!too_many_loose_objects())
> + if (gc_auto_threshold <= 0 && gc_auto_pack_limit <= 0)
> return 0;
>
> + /*
> + * If there are too many loose objects, but not too many
> + * packs, we run "repack -d -l". If there are too many packs,
> + * we run "repack -A -d -l". Otherwise we tell the caller
> + * there is no need.
> + */
> argv_repack[ac++] = "repack";
> + if (too_many_packs())
> + argv_repack[ac++] = "-A";
> + if (!too_many_loose_objects() && ac == 1)
> + return 0;
Why not
else if (!too_many_loose_objects())
return 0;
Hmm?
Ciao,
Dscho
next prev parent reply other threads:[~2007-09-17 9:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-17 8:44 [PATCH 1/8] Export matches_pack_name() and fix its return value Junio C Hamano
2007-09-17 8:44 ` [PATCH 2/8] pack-objects --keep-unreachable Junio C Hamano
2007-09-17 8:44 ` [PATCH 3/8] repack -A -d: use --keep-unreachable when repacking Junio C Hamano
2007-09-17 9:29 ` Johannes Schindelin
2007-09-17 10:00 ` Andreas Ericsson
2007-09-18 3:01 ` Shawn O. Pearce
2007-09-17 8:44 ` [PATCH 4/8] git-gc --auto: move threshold check to need_to_gc() function Junio C Hamano
2007-09-17 8:44 ` [PATCH 5/8] git-gc --auto: add documentation Junio C Hamano
2007-09-17 9:36 ` Johannes Schindelin
2007-09-17 19:54 ` Junio C Hamano
2007-09-17 8:44 ` [PATCH 6/8] git-gc --auto: protect ourselves from accumulated cruft Junio C Hamano
2007-09-17 8:44 ` [PATCH 7/8] git-gc --auto: restructure the way "repack" command line is built Junio C Hamano
2007-09-17 9:41 ` Johannes Schindelin
2007-09-17 19:53 ` Junio C Hamano
2007-09-17 8:44 ` [PATCH 8/8] git-gc --auto: run "repack -A -d -l" as necessary Junio C Hamano
2007-09-17 9:53 ` Johannes Schindelin [this message]
2007-09-17 19:54 ` Junio C Hamano
2007-09-18 2:59 ` Shawn O. Pearce
-- strict thread matches above, loose matches on Subject: below --
2007-09-17 8:27 [PATCH 0/8] Updated git-gc --auto series Junio C Hamano
2007-09-17 8:27 ` [PATCH 8/8] git-gc --auto: run "repack -A -d -l" as necessary Junio C Hamano
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=Pine.LNX.4.64.0709171044170.28586@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).