Merge branch 'sb/plug-transport-leak'
[gitweb.git] / builtin / config.c
index aba71355f864202932e02bddb804d2fa3c0783d8..8cc2604069cd008297081988ac807412ba9901a7 100644 (file)
@@ -296,7 +296,8 @@ static int git_get_color_config(const char *var, const char *value, void *cb)
        if (!strcmp(var, get_color_slot)) {
                if (!value)
                        config_error_nonbool(var);
-               color_parse(value, var, parsed_color);
+               if (color_parse(value, parsed_color) < 0)
+                       return -1;
                get_color_found = 1;
        }
        return 0;
@@ -309,8 +310,10 @@ static void get_color(const char *def_color)
        git_config_with_options(git_get_color_config, NULL,
                                &given_config_source, respect_includes);
 
-       if (!get_color_found && def_color)
-               color_parse(def_color, "command line", parsed_color);
+       if (!get_color_found && def_color) {
+               if (color_parse(def_color, parsed_color) < 0)
+                       die(_("unable to parse default color value"));
+       }
 
        fputs(parsed_color, stdout);
 }
@@ -611,7 +614,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
                check_argc(argc, 2, 2);
                value = normalize_value(argv[0], argv[1]);
                return git_config_set_multivar_in_file(given_config_source.file,
-                                                      argv[0], value, "^$", 0);
+                                                      argv[0], value,
+                                                      CONFIG_REGEX_NONE, 0);
        }
        else if (actions == ACTION_REPLACE_ALL) {
                check_write();