fsck: support ignoring objects in `git fsck` via fsck.skiplist
[gitweb.git] / builtin / fsck.c
index 070909ef208fe6815898b35539540c39da8448ad..67237a6861cc1d7bc47ac7466507cdb66548ba56 100644 (file)
@@ -49,6 +49,19 @@ static int show_dangling = 1;
 
 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;