Re: [PATCH v2] Custom compression levels for objects and packs
On Wed, May 09, 2007 at 12:38:22AM CEST, Dana How wrote:
Show 13 quoted lines
> diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
> index 8824793..e80a1d6 100644
> --- a/builtin-pack-objects.c
> +++ b/builtin-pack-objects.c
> @@ -444,6 +446,10 @@ static unsigned long write_object(struct sha1file *f,
> * and we do not need to deltify it.
> */
>
> + /* differing core & pack compression when loose object -> must recompress */
> + if (!entry->in_pack && pack_compression_level != zlib_compression_level)
> + to_reuse = 0;
> + else
> if (!entry->in_pack && !entry->delta) {Style: the else and if should be probably on the same line.
Show 19 quoted lines
> unsigned char *map;
> unsigned long mapsize;
> @@ -1624,6 +1630,16 @@ static int git_pack_config(const char *k, const char *v)
> window = git_config_int(k, v);
> return 0;
> }
> + if (!strcmp(k, "pack.compression")) {
> + int level = git_config_int(k, v);
> + if (level == -1)
> + level = Z_DEFAULT_COMPRESSION;
> + else if (level < 0 || level > Z_BEST_COMPRESSION)
> + die("bad pack compression level %d", level);
> + pack_compression_level = level;
> + pack_compression_seen = 1;
> + return 0;
> + }
> return git_default_config(k, v);
> }
> Where is this documented?
Show 19 quoted lines
> @@ -1761,6 +1779,18 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
> usage(pack_usage);
> continue;
> }
> + if (!prefixcmp(arg, "--compression=")) {
> + char *end;
> + int level = strtoul(arg+14, &end, 0);
> + if (!arg[14] || *end)
> + usage(pack_usage);
> + if (level == -1)
> + level = Z_DEFAULT_COMPRESSION;
> + else if (level < 0 || level > Z_BEST_COMPRESSION)
> + die("bad pack compression level %d", level);
> + pack_compression_level = level;
> + continue;
> + }
> if (!prefixcmp(arg, "--window=")) {
> char *end;
> window = strtoul(arg+9, &end, 0);Where is this documented?
Show 10 quoted lines
> diff --git a/config.c b/config.c
> index 70d1055..5627ed6 100644
> --- a/config.c
> +++ b/config.c
> @@ -304,13 +306,27 @@ int git_default_config(const char *var, const char *value)
> return 0;
> }
>
> - if (!strcmp(var, "core.compression")) {
> + if (!strcmp(var, "core.loosecompression")) {Is this config variable documented?
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Ever try. Ever fail. No matter. // Try again. Fail again. Fail better.
-- Samuel Beckett