Re: [PATCH] Add --aggressive option to 'git gc'
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 10, 2007, 07:38 UTC
- Message-ID
- <7vzm4dku0f.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20070509194839.GB10280@thunk.org>
Theodore Tso <tytso@mit.edu> writes:
> Junio, would you be willing to apply this?
Yes, but ;-).
Show 16 quoted lines
> static int pack_refs = -1;
> +static int aggressive_window = -1;
>
> +#define MAX_ADD 10
> static const char *argv_pack_refs[] = {"pack-refs", "--prune", NULL};
> static const char *argv_reflog[] = {"reflog", "expire", "--all", NULL};
> -static const char *argv_repack[] = {"repack", "-a", "-d", "-l", NULL};
> +static const char *argv_repack[MAX_ADD] = {"repack", "-a", "-d", "-l", NULL};
> static const char *argv_prune[] = {"prune", NULL};
> static const char *argv_rerere[] = {"rerere", "gc", NULL};
>
> @@ -34,13 +36,34 @@ static int gc_config(const char *var, const char *value)
> pack_refs = git_config_bool(var, value);
> return 0;
> }
> + if (!strcmp(var, "gc.aggressiveWindow")) {Callbacks to git_config() are called with variable names downcased (except for the 2nd level for 3-level variables. E.g. [REMOTE "Foo"] URL = ...; becomes var = "remote.Foo.url", val = ...).
> + aggressive_window = git_config_int(var, value);
> + printf("aggressive_window = %d\n", aggressive_window);Did you mean to leave this in? Looks like a debug remnant...
Show 6 quoted lines
> + return 0; > + } > return git_default_config(var, value); > } > > +static append_option(const char **cmd, const char *opt, int max_length)
Type is "static void" I presume.
> +{
> + int i;Funny tab here.
> + > + for (i=0; cmd[i]; i++) > + ;
SP around operator '='.
> +
> + if (i+2 >= max_length) {Same for '+'
> + fprintf(stderr, "Too many options specified\n"); > + exit(1);
die("Too many...specified"); /* note the lack of \n at the end */> + } > + cmd[i++] = opt; > + cmd[i] = 0;
We tend to spell out NULL, although we all are aware that C says literal '0' is the null pointer.
All fixups are trivial so I'd take the patch and amend locally.