Skip to content

Commit 41f98fa

Browse files
peffgitster
authored andcommitted
config: reject bogus values for core.checkstat
If you feed nonsense config like: git -c core.checkstat=foobar status we'll silently ignore the unknown value, rather than reporting an error. This goes all the way back to c08e4d5 (Enable minimal stat checking, 2013-01-22). Detecting and complaining now is technically a backwards-incompatible change, but I don't think anybody has any reason to use an invalid value here. There are no historical values we'd want to allow for backwards compatibility or anything like that. We are better off loudly telling the user that their config may not be doing what they expect. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d49cb16 commit 41f98fa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

config.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,9 @@ static int git_default_core_config(const char *var, const char *value,
13921392
check_stat = 1;
13931393
else if (!strcasecmp(value, "minimal"))
13941394
check_stat = 0;
1395+
else
1396+
return error(_("invalid value for '%s': '%s'"),
1397+
var, value);
13951398
}
13961399

13971400
if (!strcmp(var, "core.quotepath")) {

0 commit comments

Comments
 (0)