Merge branch 'pw/3.0-commentchar-auto-deprecation'
"core.commentChar=auto" that attempts to dynamically pick a suitable comment character is non-workable, as it is too much trouble to support for little benefit, and is marked as deprecated. * pw/3.0-commentchar-auto-deprecation: commit: print advice when core.commentString=auto config: warn on core.commentString=auto breaking-changes: deprecate support for core.commentString=auto
This commit is contained in:
@@ -121,7 +121,10 @@ int protect_ntfs = PROTECT_NTFS_DEFAULT;
|
||||
*/
|
||||
const char *comment_line_str = "#";
|
||||
char *comment_line_str_to_free;
|
||||
#ifndef WITH_BREAKING_CHANGES
|
||||
int auto_comment_line_char;
|
||||
bool warn_on_auto_comment_char;
|
||||
#endif /* !WITH_BREAKING_CHANGES */
|
||||
|
||||
/* This is set by setup_git_directory_gently() and/or git_default_config() */
|
||||
char *git_work_tree_cfg;
|
||||
@@ -463,16 +466,22 @@ static int git_default_core_config(const char *var, const char *value,
|
||||
|
||||
if (!strcmp(var, "core.commentchar") ||
|
||||
!strcmp(var, "core.commentstring")) {
|
||||
if (!value)
|
||||
if (!value) {
|
||||
return config_error_nonbool(var);
|
||||
else if (!strcasecmp(value, "auto"))
|
||||
#ifndef WITH_BREAKING_CHANGES
|
||||
} else if (!strcasecmp(value, "auto")) {
|
||||
auto_comment_line_char = 1;
|
||||
else if (value[0]) {
|
||||
FREE_AND_NULL(comment_line_str_to_free);
|
||||
comment_line_str = "#";
|
||||
#endif /* !WITH_BREAKING_CHANGES */
|
||||
} else if (value[0]) {
|
||||
if (strchr(value, '\n'))
|
||||
return error(_("%s cannot contain newline"), var);
|
||||
comment_line_str = value;
|
||||
FREE_AND_NULL(comment_line_str_to_free);
|
||||
#ifndef WITH_BREAKING_CHANGES
|
||||
auto_comment_line_char = 0;
|
||||
#endif /* !WITH_BREAKING_CHANGES */
|
||||
} else
|
||||
return error(_("%s must have at least one character"), var);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user