const char *p;
if (!memchr(sb->buf, candidates[0], sb->len)) {
- comment_line_str = xstrfmt("%c", candidates[0]);
+ free(comment_line_str_to_free);
+ comment_line_str = comment_line_str_to_free =
+ xstrfmt("%c", candidates[0]);
return;
}
if (!*p)
die(_("unable to select a comment character that is not used\n"
"in the current commit message"));
- comment_line_str = xstrfmt("%c", *p);
+ free(comment_line_str_to_free);
+ comment_line_str = comment_line_str_to_free = xstrfmt("%c", *p);
}
static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,
else if (value[0]) {
if (strchr(value, '\n'))
return error(_("%s cannot contain newline"), var);
- comment_line_str = xstrdup(value);
+ comment_line_str = value;
+ FREE_AND_NULL(comment_line_str_to_free);
auto_comment_line_char = 0;
} else
return error(_("%s must have at least one character"), var);
* that is subject to stripspace.
*/
const char *comment_line_str = "#";
+char *comment_line_str_to_free;
int auto_comment_line_char;
/* Parallel index stat data preload? */
* that is subject to stripspace.
*/
extern const char *comment_line_str;
+extern char *comment_line_str_to_free;
extern int auto_comment_line_char;
/*