login
Header Space

 
 

Re: [PATCH 1/3] repack: modify behavior of -A option to leave unreferenced objects unpacked

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jeff King <peff@...>
Cc: <gitster@...>, <git@...>
Date: Sunday, May 11, 2008 - 12:51 am

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


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;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: git gc &amp; deleted branches, Brandon Casey, (Thu May 8, 9:41 pm)
Re: git gc &amp; deleted branches, Jeff King, (Fri May 9, 12:19 am)
Re: git gc &amp; deleted branches, Geert Bosch, (Fri May 9, 11:00 am)
Re: git gc &amp; deleted branches, Brandon Casey, (Fri May 9, 11:14 am)
Re: git gc &amp; deleted branches, Nicolas Pitre, (Fri May 9, 12:12 pm)
Re: git gc &amp; deleted branches, Junio C Hamano, (Fri May 9, 6:33 pm)
Re: git gc &amp; deleted branches, Jeremy Maitin-Shepard, (Fri May 9, 8:07 pm)
Re: git gc &amp; deleted branches, Shawn O. Pearce, (Fri May 9, 8:20 pm)
Re: git gc &amp; deleted branches, Junio C Hamano, (Fri May 9, 9:21 pm)
Re: git gc &amp; deleted branches, Jeremy Maitin-Shepard, (Fri May 9, 9:51 pm)
Re: git gc &amp; deleted branches, Jeff King, (Sat May 10, 1:25 am)
Re: git gc &amp; deleted branches, Jeremy Maitin-Shepard, (Sat May 10, 1:36 am)
Re: git gc &amp; deleted branches, Johannes Schindelin, (Sat May 10, 5:04 am)
Re: git gc &amp; deleted branches, Jeremy Maitin-Shepard, (Sat May 10, 12:24 pm)
Re: git gc &amp; deleted branches, Johannes Schindelin, (Sun May 11, 7:11 am)
Re: git gc &amp; deleted branches, Jeremy Maitin-Shepard, (Fri May 9, 8:43 pm)
Re: git gc &amp; deleted branches, Brandon Casey, (Fri May 9, 12:54 pm)
Re: git gc &amp; deleted branches, Jeff King, (Fri May 9, 11:53 am)
Re: git gc &amp; deleted branches, Brandon Casey, (Fri May 9, 11:56 am)
Re: git gc &amp; deleted branches, Junio C Hamano, (Thu May 8, 11:21 pm)
Re: [PATCH 1/3] repack: modify behavior of -A option to leav..., Brandon Casey, (Sun May 11, 12:51 am)
speck-geostationary