]> git.ipfire.org Git - thirdparty/git.git/blobdiff - config.c
Start the 2.46 cycle
[thirdparty/git.git] / config.c
index dab92e581bd857e7467e0e5deafb353a0131eef7..ae3652b08fa6f36af6c085e36b89efdd46d72389 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1565,24 +1565,29 @@ static int git_default_core_config(const char *var, const char *value,
        if (!strcmp(var, "core.editor"))
                return git_config_string(&editor_program, var, value);
 
-       if (!strcmp(var, "core.commentchar")) {
+       if (!strcmp(var, "core.commentchar") ||
+           !strcmp(var, "core.commentstring")) {
                if (!value)
                        return config_error_nonbool(var);
                else if (!strcasecmp(value, "auto"))
                        auto_comment_line_char = 1;
-               else if (value[0] && !value[1]) {
-                       comment_line_char = value[0];
+               else if (value[0]) {
+                       if (strchr(value, '\n'))
+                               return error(_("%s cannot contain newline"), var);
+                       comment_line_str = xstrdup(value);
                        auto_comment_line_char = 0;
                } else
-                       return error(_("core.commentChar should only be one ASCII character"));
+                       return error(_("%s must have at least one character"), var);
                return 0;
        }
 
        if (!strcmp(var, "core.askpass"))
                return git_config_string(&askpass_program, var, value);
 
-       if (!strcmp(var, "core.excludesfile"))
+       if (!strcmp(var, "core.excludesfile")) {
+               free((char *)excludes_file);
                return git_config_pathname(&excludes_file, var, value);
+       }
 
        if (!strcmp(var, "core.whitespace")) {
                if (!value)