summaryrefslogtreecommitdiff
path: root/csum-file.c
diff options
context:
space:
mode:
authorDana How <danahow@gmail.com>2007-05-09 20:56:50 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-05-10 22:23:09 (GMT)
commit960ccca6803c9fb57429d43572a9545a96107e32 (patch)
treefcacfbd86e9411c75313132a14562c35c2f83ca9 /csum-file.c
parent479b56ba50144b30f28c5b225d412125c07def9f (diff)
downloadgit-960ccca6803c9fb57429d43572a9545a96107e32.zip
git-960ccca6803c9fb57429d43572a9545a96107e32.tar.gz
git-960ccca6803c9fb57429d43572a9545a96107e32.tar.bz2
Custom compression levels for objects and packs
Add config variables pack.compression and core.loosecompression , and switch --compression=level to pack-objects. Loose objects will be compressed using core.loosecompression if set, else core.compression if set, else Z_BEST_SPEED. Packed objects will be compressed using --compression=level if seen, else pack.compression if set, else core.compression if set, else Z_DEFAULT_COMPRESSION. This is the "pack compression level". Loose objects added to a pack undeltified will be recompressed to the pack compression level if it is unequal to the current loose compression level by the preceding rules, or if the loose object was written while core.legacyheaders = true. Newly deltified loose objects are always compressed to the current pack compression level. Previously packed objects added to a pack are recompressed to the current pack compression level exactly when their deltification status changes, since the previous pack data cannot be reused. In either case, the --no-reuse-object switch from the first patch below will always force recompression to the current pack compression level, instead of assuming the pack compression level hasn't changed and pack data can be reused when possible. This applies on top of the following patches from Nicolas Pitre: [PATCH] allow for undeltified objects not to be reused [PATCH] make "repack -f" imply "pack-objects --no-reuse-object" Signed-off-by: Dana L. How <danahow@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'csum-file.c')
-rw-r--r--csum-file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/csum-file.c b/csum-file.c
index 7c806ad..7088f6e 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -119,14 +119,14 @@ struct sha1file *sha1fd(int fd, const char *name)
return f;
}
-int sha1write_compressed(struct sha1file *f, void *in, unsigned int size)
+int sha1write_compressed(struct sha1file *f, void *in, unsigned int size, int level)
{
z_stream stream;
unsigned long maxsize;
void *out;
memset(&stream, 0, sizeof(stream));
- deflateInit(&stream, zlib_compression_level);
+ deflateInit(&stream, level);
maxsize = deflateBound(&stream, size);
out = xmalloc(maxsize);