config: use git_config_string() for core.checkRoundTripEncoding
Since this code path was recently converted to check for a NULL value, it now behaves exactly like git_config_string(). We can shorten the code a bit by using that helper. Note that git_config_string() takes a const pointer, but our storage variable is non-const. We're better off making this "const", though, since the default value points to a string literal (and thus it would be an error if anybody tried to write to it). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0824879078
commit
be6bc048d7
8
config.c
8
config.c
@ -1551,12 +1551,8 @@ static int git_default_core_config(const char *var, const char *value,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(var, "core.checkroundtripencoding")) {
|
if (!strcmp(var, "core.checkroundtripencoding"))
|
||||||
if (!value)
|
return git_config_string(&check_roundtrip_encoding, var, value);
|
||||||
return config_error_nonbool(var);
|
|
||||||
check_roundtrip_encoding = xstrdup(value);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(var, "core.notesref")) {
|
if (!strcmp(var, "core.notesref")) {
|
||||||
if (!value)
|
if (!value)
|
||||||
|
@ -92,7 +92,7 @@ void convert_attrs(struct index_state *istate,
|
|||||||
struct conv_attrs *ca, const char *path);
|
struct conv_attrs *ca, const char *path);
|
||||||
|
|
||||||
extern enum eol core_eol;
|
extern enum eol core_eol;
|
||||||
extern char *check_roundtrip_encoding;
|
extern const char *check_roundtrip_encoding;
|
||||||
const char *get_cached_convert_stats_ascii(struct index_state *istate,
|
const char *get_cached_convert_stats_ascii(struct index_state *istate,
|
||||||
const char *path);
|
const char *path);
|
||||||
const char *get_wt_convert_stats_ascii(const char *path);
|
const char *get_wt_convert_stats_ascii(const char *path);
|
||||||
|
@ -64,7 +64,7 @@ const char *excludes_file;
|
|||||||
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
|
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
|
||||||
enum eol core_eol = EOL_UNSET;
|
enum eol core_eol = EOL_UNSET;
|
||||||
int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
|
int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
|
||||||
char *check_roundtrip_encoding = "SHIFT-JIS";
|
const char *check_roundtrip_encoding = "SHIFT-JIS";
|
||||||
enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
|
enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
|
||||||
enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
|
enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
|
||||||
enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
|
enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
|
||||||
|
Reference in New Issue
Block a user