fsck: support ignoring objects in `git fsck` via fsck.skiplist
Identical to support in `git receive-pack for the config option `receive.fsck.skiplist`, we now support ignoring given objects in `git fsck` via `fsck.skiplist` altogether. This is extremely handy in case of legacy repositories where it would cause more pain to change incorrect objects than to live with them (e.g. a duplicate 'author' line in an early commit object). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Jun 22, 2015 at 17:27 UTC
1335f732892601368876e0e41c9ea288c2ab18f3
2 files changed
+21
Documentation/config.txt
+8
@@ -1253,6 +1253,14 @@ that setting `fsck.missingEmail = ignore` will hide that issue.
1253
This feature is intended to support working with legacy repositories
1254
which cannot be repaired without disruptive changes.
1255
1256
+fsck.skipList::
1257
+ The path to a sorted list of object names (i.e. one SHA-1 per
1258
+ line) that are known to be broken in a non-fatal way and should
1259
+ be ignored. This feature is useful when an established project
1260
+ should be accepted despite early commits containing errors that
1261
+ can be safely ignored such as invalid committer email addresses.
1262
+ Note: corrupt objects cannot be skipped with this setting.
1263
+
1264
gc.aggressiveDepth::
1265
The depth parameter used in the delta compression
1266
algorithm used by 'git gc --aggressive'. This defaults
builtin/fsck.c
+13
@@ -49,6 +49,19 @@ static int show_dangling = 1;
49
50
static int fsck_config(const char *var, const char *value, void *cb)
51
{
52
+ if (strcmp(var, "fsck.skiplist") == 0) {
53
+ const char *path;
54
+ struct strbuf sb = STRBUF_INIT;
55
+
56
+ if (git_config_pathname(&path, var, value))
57
+ return 1;
58
+ strbuf_addf(&sb, "skiplist=%s", path);
59
+ free((char *)path);
60
+ fsck_set_msg_types(&fsck_obj_options, sb.buf);
61
+ strbuf_release(&sb);
62
+ return 0;
63
+ }
64
+
65
if (skip_prefix(var, "fsck.", &var)) {
66
fsck_set_msg_type(&fsck_obj_options, var, value);
67
return 0;