aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-05-20 02:19:19 -0700
committerJunio C Hamano <junkio@cox.net>2007-05-20 02:19:19 -0700
commit45bde46bfb9cbc5565f9fc6caa819333578c53e1 (patch)
tree48f99ae41d842204af4ea63d3bd7bff788b068e3 /config.c
parente223249a13799c047797c80eab21e4e257283c3d (diff)
parent960ccca6803c9fb57429d43572a9545a96107e32 (diff)
downloadgit-45bde46bfb9cbc5565f9fc6caa819333578c53e1.tar.gz
git-45bde46bfb9cbc5565f9fc6caa819333578c53e1.tar.xz
Merge branch 'dh/pack'
* dh/pack: Custom compression levels for objects and packs
Diffstat (limited to 'config.c')
-rw-r--r--config.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/config.c b/config.c
index 521ebef38..0614c2b29 100644
--- a/config.c
+++ b/config.c
@@ -12,6 +12,8 @@
static FILE *config_file;
static const char *config_file_name;
static int config_linenr;
+static int zlib_compression_seen;
+
static int get_next_char(void)
{
int c;
@@ -299,13 +301,27 @@ int git_default_config(const char *var, const char *value)
return 0;
}
- if (!strcmp(var, "core.compression")) {
+ if (!strcmp(var, "core.loosecompression")) {
int level = git_config_int(var, value);
if (level == -1)
level = Z_DEFAULT_COMPRESSION;
else if (level < 0 || level > Z_BEST_COMPRESSION)
die("bad zlib compression level %d", level);
zlib_compression_level = level;
+ zlib_compression_seen = 1;
+ return 0;
+ }
+
+ if (!strcmp(var, "core.compression")) {
+ int level = git_config_int(var, value);
+ if (level == -1)
+ level = Z_DEFAULT_COMPRESSION;
+ else if (level < 0 || level > Z_BEST_COMPRESSION)
+ die("bad zlib compression level %d", level);
+ core_compression_level = level;
+ core_compression_seen = 1;
+ if (!zlib_compression_seen)
+ zlib_compression_level = level;
return 0;
}