Skip to content

Commit a627126

Browse files
peffgitster
authored andcommitted
setup: handle NULL value when parsing extensions
The "partialclone" extension config records a string, and hence it is an error to have an implicit bool like: [extensions] partialclone in your config. We should recognize and reject this, rather than segfaulting (which is the current behavior). Note that it's OK to use config_error_nonbool() here, even though the return value is an enum. We explicitly document EXTENSION_ERROR as -1 for compatibility with error(), etc. This is the only extension value that has this problem. Most of the others are bools that interpret this value naturally. The exception is extensions.objectformat, which does correctly check for NULL. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ba176db commit a627126

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

setup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ static enum extension_result handle_extension_v0(const char *var,
559559
data->precious_objects = git_config_bool(var, value);
560560
return EXTENSION_OK;
561561
} else if (!strcmp(ext, "partialclone")) {
562+
if (!value)
563+
return config_error_nonbool(var);
562564
data->partial_clone = xstrdup(value);
563565
return EXTENSION_OK;
564566
} else if (!strcmp(ext, "worktreeconfig")) {

0 commit comments

Comments
 (0)