git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] Custom compression levels for objects and packs

From
Petr Baudis <pasky@suse.cz>
Date
May 9, 2007, 00:30 UTC
Message-ID
<20070509003016.GJ4489@pasky.or.cz>
In-Reply-To
<4640FBDE.1000609@gmail.com>
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
Previous: Dana HowNext: Theodore Tso
Message 21 of 23 in “Custom compression levels for objects and packs”
  1. Custom compression levels for objects and packsDana How, May 8, 2007
  2. Junio C HamanoMay 8, 2007
  3. Nicolas PitreMay 9, 2007
  4. Dana HowMay 9, 2007
  5. Nicolas PitreMay 9, 2007
  6. Dana HowMay 9, 2007
  7. Junio C HamanoMay 9, 2007
  8. Dana HowMay 9, 2007
  9. Nicolas PitreMay 9, 2007
  10. Dana HowMay 9, 2007
  11. Nicolas PitreMay 9, 2007
  12. Junio C HamanoMay 9, 2007
  13. Dana HowMay 9, 2007
  14. make "repack -f" imply "pack-objects --no-reuse-object"Nicolas Pitre, May 9, 2007
  15. deprecate the new loose object header formatNicolas Pitre, May 9, 2007
  16. Dana HowMay 9, 2007
  17. Nicolas PitreMay 9, 2007
  18. Dana HowMay 9, 2007
  19. Junio C HamanoMay 9, 2007
  20. Dana HowMay 9, 2007
  21. Petr BaudisMay 9, 2007
  22. Theodore TsoMay 9, 2007
  23. Dana HowMay 9, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.