]> git.ipfire.org Git - thirdparty/git.git/blobdiff - config.c
Merge branch 'jk/core-comment-string'
[thirdparty/git.git] / config.c
index dab92e581bd857e7467e0e5deafb353a0131eef7..eebce8c7e09393fa8756230e483965674b9afbdf 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1565,16 +1565,19 @@ 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;
        }