]> git.ipfire.org Git - thirdparty/git.git/blobdiff - config.c
Sync with 2.32.7
[thirdparty/git.git] / config.c
index 159ae9c72c7b4c7655e5e1dc516c6519dc23b5f6..ea39153e31bc8e4d0fcb11d7ddb1b08b45cce9f3 100644 (file)
--- a/config.c
+++ b/config.c
@@ -76,7 +76,6 @@ static struct key_value_info *current_config_kvi;
  */
 static enum config_scope current_parsing_scope;
 
-static int core_compression_seen;
 static int pack_compression_seen;
 static int zlib_compression_seen;
 
@@ -1400,8 +1399,6 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
                        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;
                if (!pack_compression_seen)
@@ -1833,9 +1830,10 @@ static int git_config_from_blob_ref(config_fn_t fn,
 char *git_system_config(void)
 {
        char *system_config = xstrdup_or_null(getenv("GIT_CONFIG_SYSTEM"));
-       if (system_config)
-               return system_config;
-       return system_path(ETC_GITCONFIG);
+       if (!system_config)
+               system_config = system_path(ETC_GITCONFIG);
+       normalize_path_copy(system_config, system_config);
+       return system_config;
 }
 
 void git_global_config(char **user_out, char **xdg_out)
@@ -2072,7 +2070,7 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
                e = xmalloc(sizeof(*e));
                hashmap_entry_init(&e->ent, strhash(key));
                e->key = xstrdup(key);
-               string_list_init(&e->value_list, 1);
+               string_list_init_dup(&e->value_list);
                hashmap_add(&cs->config_hash, &e->ent);
        }
        si = string_list_append_nodup(&e->value_list, xstrdup_or_null(value));
@@ -2837,7 +2835,7 @@ static void maybe_remove_section(struct config_store_data *store,
        begin = store->parsed[i].begin;
 
        /*
-        * Next, make sure that we are removing he last key(s) in the section,
+        * Next, make sure that we are removing the last key(s) in the section,
         * and that there are no comments that are possibly about the current
         * section.
         */
@@ -3051,7 +3049,8 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
                if (contents == MAP_FAILED) {
                        if (errno == ENODEV && S_ISDIR(st.st_mode))
                                errno = EISDIR;
-                       error_errno(_("unable to mmap '%s'"), config_filename);
+                       error_errno(_("unable to mmap '%s'%s"),
+                                       config_filename, mmap_os_err());
                        ret = CONFIG_INVALID_FILE;
                        contents = NULL;
                        goto out_free;