git-gc --auto: move threshold check to need_to_gc() function.
That is where we decide if we are going to run gc automatically. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
65aa53029a
commit
caf9de2f46
@ -80,6 +80,13 @@ static int need_to_gc(void)
|
||||
int num_loose = 0;
|
||||
int needed = 0;
|
||||
|
||||
/*
|
||||
* Setting gc.auto to 0 or negative can disable the
|
||||
* automatic gc
|
||||
*/
|
||||
if (gc_auto_threshold <= 0)
|
||||
return 0;
|
||||
|
||||
if (sizeof(path) <= snprintf(path, sizeof(path), "%s/17", objdir)) {
|
||||
warning("insanely long object directory %.*s", 50, objdir);
|
||||
return 0;
|
||||
@ -129,8 +136,6 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(arg, "--auto")) {
|
||||
if (gc_auto_threshold <= 0)
|
||||
return 0;
|
||||
auto_gc = 1;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user