git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Brandon Casey" <drafnel@gmail.com>
To: "Jeff King" <peff@peff.net>
Cc: gitster@pobox.com, git@vger.kernel.org
Subject: Re: [PATCH 1/3] repack: modify behavior of -A option to leave unreferenced objects unpacked
Date: Sat, 10 May 2008 23:51:41 -0500	[thread overview]
Message-ID: <ee63ef30805102151r54121e46n4aac3f951077b4fd@mail.gmail.com> (raw)
In-Reply-To: <ee63ef30805102116m68e83fadr8ef9afb080d26cf0@mail.gmail.com>

On Sat, May 10, 2008 at 11:16 PM, Brandon Casey <drafnel@gmail.com> wrote:

> I've got a thought. How about limiting how often auto repack repacks
> by looking at the timestamp of the most recent pack? Wouldn't the
> packs already be prepared in most cases i.e. prepare_packed_git()

completely untested and hopefully not mangled by google...

actually, this will do nothing for the case where there exists many
loose unreachable objects and no loose reachable objects since we
won't create a new pack with an updated timestamp to compare against.
So git-gc will continue to spin its wheels without getting anywhere.
Could we update the pack timestamp after running git-gc or use a
timestamp from someplace else?

-brandon

diff --git a/builtin-gc.c b/builtin-gc.c
index 48f7d95..16b1455 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -27,6 +27,7 @@ static int aggressive_window = -1;
 static int gc_auto_threshold = 6700;
 static int gc_auto_pack_limit = 50;
 static char *prune_expire = "2.weeks.ago";
+static time_t gc_auto_pack_frequency = 21600;  /* 6 hours */

 #define MAX_ADD 10
 static const char *argv_pack_refs[] = {"pack-refs", "--all", "--prune", NULL};
@@ -56,6 +57,10 @@ static int gc_config(const char *var, const char *value)
                gc_auto_pack_limit = git_config_int(var, value);
                return 0;
        }
+       if (!strcmp(var, "gc.autopackfrequency")) {
+               gc_auto_pack_frequency = git_config_ulong(var, value);
+               return 0;
+       }
        if (!strcmp(var, "gc.pruneexpire")) {
                if (!value)
                        return config_error_nonbool(var);
@@ -205,6 +210,14 @@ static int need_to_gc(void)
        else if (!too_many_loose_objects())
                return 0;

+       if (gc_auto_pack_frequency) {
+               prepare_packed_git();
+               if (packed_git &&
+                   packed_git->mtime >
+                   approxidate("now") - gc_auto_pack_frequency)
+                       return 0;
+       }
+
        if (run_hook())
                return 0;
        return 1;

  reply	other threads:[~2008-05-11  4:53 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08 17:45 git gc & deleted branches Guido Ostkamp
2008-05-08 18:39 ` Jeff King
2008-05-08 18:55   ` Guido Ostkamp
2008-05-08 20:07     ` Brandon Casey
2008-05-08 20:52       ` Guido Ostkamp
2008-05-08 21:01         ` Jeff King
2008-05-08 21:15           ` Nicolas Pitre
2008-05-08 21:17             ` Jeff King
2008-05-08 21:23               ` Brandon Casey
2008-05-08 21:31                 ` Jeff King
2008-05-08 21:40                   ` Brandon Casey
2008-05-08 21:44                     ` Jeff King
2008-05-08 21:53                       ` Brandon Casey
2008-05-08 22:48                         ` Jeff King
2008-05-09  1:41                           ` Brandon Casey
2008-05-09  3:21                             ` Junio C Hamano
     [not found]                               ` <ee63ef30805082105w7f04a2d1y65a4618aeb787cac@mail.gmail.com>
     [not found]                                 ` <7v1w4bb291.fsf@gitster.siamese.dyndns.org>
2008-05-10  3:32                                   ` Brandon Casey
2008-05-10  4:15                                     ` Brandon Casey
2008-05-10  4:01                               ` [PATCH 0/3] leave unreferenced objects unpacked drafnel
2008-05-10  4:01                               ` [PATCH 1/3] repack: modify behavior of -A option to " drafnel
2008-05-10  6:03                                 ` Jeff King
2008-05-11  1:10                                   ` Nicolas Pitre
2008-05-11  1:23                                     ` Junio C Hamano
2008-05-11  4:16                                   ` Brandon Casey
2008-05-11  4:51                                     ` Brandon Casey [this message]
2008-05-10  4:01                               ` [PATCH 2/3] git-gc: always use -A when manually repacking drafnel
2008-05-10  4:01                               ` [PATCH 3/3] builtin-gc.c: deprecate --prune, it now really has no effect drafnel
2008-05-09  4:19                             ` git gc & deleted branches Jeff King
2008-05-09 15:00                               ` Geert Bosch
2008-05-09 15:14                                 ` Brandon Casey
2008-05-09 15:53                                   ` Jeff King
2008-05-09 15:56                                     ` Brandon Casey
2008-05-09 16:12                                   ` Nicolas Pitre
2008-05-09 16:54                                     ` Brandon Casey
2008-05-09 22:33                                     ` Junio C Hamano
2008-05-09 23:09                                       ` [PATCH] Updating documentation to match Brandon Casey's proposed git-repack patch Chris Frey
2008-05-10  0:07                                       ` git gc & deleted branches Jeremy Maitin-Shepard
2008-05-10  0:20                                         ` Shawn O. Pearce
2008-05-10  0:43                                           ` Jeremy Maitin-Shepard
2008-05-10  1:21                                           ` Junio C Hamano
2008-05-10  1:51                                             ` Jeremy Maitin-Shepard
2008-05-10  5:25                                               ` Jeff King
2008-05-10  5:36                                                 ` Jeremy Maitin-Shepard
2008-05-10  9:04                                                   ` Johannes Schindelin
2008-05-10 16:24                                                     ` Jeremy Maitin-Shepard
2008-05-11 11:11                                                       ` Johannes Schindelin
2008-05-11 18:39                                                         ` Junio C Hamano
2008-05-08 21:33           ` Guido Ostkamp
2008-05-08 20:56       ` Jeff King
2008-05-08 20:51     ` 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

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

  git send-email \
    --in-reply-to=ee63ef30805102151r54121e46n4aac3f951077b4fd@mail.gmail.com \
    --to=drafnel@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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.
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).