remote.c: refactor match_explicit_refs()
[gitweb.git] / config.c
index 521ebef3819bff1705d652684780434d6ab3fca7..58d3ed5d371b6d7548f6677e65135bd3f01851d0 100644 (file)
--- 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;
        }
 
@@ -605,7 +621,7 @@ static ssize_t find_beginning_of_line(const char* contents, size_t size,
        size_t equal_offset = size, bracket_offset = size;
        ssize_t offset;
 
-       for (offset = offset_-2; offset > 0 
+       for (offset = offset_-2; offset > 0
                        && contents[offset] != '\n'; offset--)
                switch (contents[offset]) {
                        case '=': equal_offset = offset; break;
@@ -973,4 +989,3 @@ int git_config_rename_section(const char *old_name, const char *new_name)
        free(config_filename);
        return ret;
 }
-