summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a087cc9)
raw | patch | inline | side by side (parent: a087cc9)
author | Junio C Hamano <gitster@pobox.com> | |
Mon, 17 Sep 2007 07:48:39 +0000 (00:48 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 18 Sep 2007 06:12:15 +0000 (23:12 -0700) |
We used to build the command line to run repack outside of
need_to_gc() but with the next patch we would want to tweak the
command line depending on the nature of need.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
need_to_gc() but with the next patch we would want to tweak the
command line depending on the nature of need.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-gc.c | patch | blob | history |
diff --git a/builtin-gc.c b/builtin-gc.c
index bf29f5e1a2b07d66371139948531eb5833fcbbdf..34ce35befb53397cab0edd0960b6a5df872f32e9 100644 (file)
--- a/builtin-gc.c
+++ b/builtin-gc.c
static const char *argv_prune[] = {"prune", NULL};
static const char *argv_rerere[] = {"rerere", "gc", NULL};
-static const char *argv_repack_auto[] = {"repack", "-d", "-l", NULL};
-
static int gc_config(const char *var, const char *value)
{
if (!strcmp(var, "gc.packrefs")) {
static int need_to_gc(void)
{
+ int ac = 0;
+
/*
* Setting gc.auto to 0 or negative can disable the
* automatic gc
if (gc_auto_threshold <= 0)
return 0;
- return too_many_loose_objects();
+ if (!too_many_loose_objects())
+ return 0;
+
+ argv_repack[ac++] = "repack";
+ argv_repack[ac++] = "-d";
+ argv_repack[ac++] = "-l";
+ argv_repack[ac++] = NULL;
+ return 1;
}
int cmd_gc(int argc, const char **argv, const char *prefix)
* Auto-gc should be least intrusive as possible.
*/
prune = 0;
- for (i = 0; i < ARRAY_SIZE(argv_repack_auto); i++)
- argv_repack[i] = argv_repack_auto[i];
if (!need_to_gc())
return 0;
}