Merge branch 'jc/optional-path'

"git config get --path" segfaulted on an ":(optional)path" that
does not exist, which has been corrected.

* jc/optional-path:
  config: really treat missing optional path as not configured
  config: really pretend missing :(optional) value is not there
  config: mark otherwise unused function as file-scope static
This commit is contained in:
Junio C Hamano
2025-12-05 14:49:56 +09:00
11 changed files with 102 additions and 23 deletions

12
fsck.c
View File

@@ -1398,14 +1398,16 @@ int git_fsck_config(const char *var, const char *value,
if (strcmp(var, "fsck.skiplist") == 0) {
char *path;
struct strbuf sb = STRBUF_INIT;
if (git_config_pathname(&path, var, value))
return -1;
strbuf_addf(&sb, "skiplist=%s", path);
free(path);
fsck_set_msg_types(options, sb.buf);
strbuf_release(&sb);
if (path) {
struct strbuf sb = STRBUF_INIT;
strbuf_addf(&sb, "skiplist=%s", path);
free(path);
fsck_set_msg_types(options, sb.buf);
strbuf_release(&sb);
}
return 0;
}