diff options
-rw-r--r-- | builtin/fsck.c | 20 | ||||
-rw-r--r-- | fsck.c | 24 | ||||
-rw-r--r-- | fsck.h | 7 |
3 files changed, 32 insertions, 19 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c index fbf26cafcf..821e7798c7 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -73,25 +73,7 @@ static const char *printable_type(const struct object_id *oid, static int fsck_config(const char *var, const char *value, void *cb) { - if (strcmp(var, "fsck.skiplist") == 0) { - const char *path; - struct strbuf sb = STRBUF_INIT; - - if (git_config_pathname(&path, var, value)) - return 1; - strbuf_addf(&sb, "skiplist=%s", path); - free((char *)path); - fsck_set_msg_types(&fsck_obj_options, sb.buf); - strbuf_release(&sb); - return 0; - } - - if (skip_prefix(var, "fsck.", &var)) { - fsck_set_msg_type(&fsck_obj_options, var, value); - return 0; - } - - return git_default_config(var, value, cb); + return fsck_config_internal(var, value, cb, &fsck_obj_options); } static int objerror(struct object *obj, const char *err) @@ -1310,3 +1310,27 @@ int fsck_finish(struct fsck_options *options) oidset_clear(&gitmodules_done); return ret; } + +int fsck_config_internal(const char *var, const char *value, void *cb, + struct fsck_options *options) +{ + if (strcmp(var, "fsck.skiplist") == 0) { + const char *path; + struct strbuf sb = STRBUF_INIT; + + if (git_config_pathname(&path, var, value)) + return 1; + strbuf_addf(&sb, "skiplist=%s", path); + free((char *)path); + fsck_set_msg_types(options, sb.buf); + strbuf_release(&sb); + return 0; + } + + if (skip_prefix(var, "fsck.", &var)) { + fsck_set_msg_type(options, var, value); + return 0; + } + + return git_default_config(var, value, cb); +} @@ -103,4 +103,11 @@ void fsck_put_object_name(struct fsck_options *options, const char *fsck_describe_object(struct fsck_options *options, const struct object_id *oid); +/* + * git_config() callback for use by fsck-y tools that want to support + * fsck.<msg> fsck.skipList etc. + */ +int fsck_config_internal(const char *var, const char *value, void *cb, + struct fsck_options *options); + #endif |