In Git, fsck operations can ignore known broken objects via the
`fsck.skipList` configuration. This option expects a path to a file with
the list of object names. When the configuration is specified without a
path, an error message is printed, but the command continues as if the
configuration was not set. Configuring `fsck.skipList` without a value
is a misconfiguration so config parsing should be more strict and reject
it.
Update `git_fsck_config()` to no longer ignore misconfiguration of
`fsck.skipList`. The same behavior is also present for
`fetch.fsck.skipList` and `receive.fsck.skipList` so the configuration
parsers for these are updated to ensure the related operations remain
consistent.
Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Justin Tobler committedJan 7, 2025 at 10:29 UTCca7158076f9f6e0ee1c84595aaf44194a9880a72
4 files changed+13-3
builtin/receive-pack.c
+1-1
index c2e9103f11..0158faf537 100644--- a/builtin/receive-pack.c+++ b/builtin/receive-pack.c@@ -174,7 +174,7 @@ static int receive_pack_config(const char *var, const char *value, char *path; if (git_config_pathname(&path, var, value))- return 1;+ return -1; strbuf_addf(&fsck_msg_types, "%cskiplist=%s", fsck_msg_types.len ? ',' : '=', path); free(path);
fetch-pack.c
+1-1
index 3a227721ed..055e8c3643 100644--- a/fetch-pack.c+++ b/fetch-pack.c@@ -1867,7 +1867,7 @@ int fetch_pack_fsck_config(const char *var, const char *value, char *path ; if (git_config_pathname(&path, var, value))- return 0;+ return -1; strbuf_addf(msg_types, "%cskiplist=%s", msg_types->len ? ',' : '=', path); free(path);
fsck.c
+1-1
index 87ce999a49..9fc4c25ffd 100644--- a/fsck.c+++ b/fsck.c@@ -1353,7 +1353,7 @@ int git_fsck_config(const char *var, const char *value, struct strbuf sb = STRBUF_INIT; if (git_config_pathname(&path, var, value))- return 1;+ return -1; strbuf_addf(&sb, "skiplist=%s", path); free(path); fsck_set_msg_types(options, sb.buf);