fsck: document msg-id

The documentation lacks mention of specific <msg-id> that are supported. While git-help --config will display a list of these options, often developers' first instinct is to consult the git docs to find valid config values. Add a list of fsck error messages, and link to it from the git-fsck documentation. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Cai committed Oct 25, 2022 at 15:42 UTC f6534dbda474ce9c4ce06c1f3212745724dd1724
4 files changed +183
Documentation/config/fsck.txt
+4
@@ -35,6 +35,10 @@ allow new instances of the same breakages go unnoticed.
35 Setting an unknown `fsck.<msg-id>` value will cause fsck to die, but
36 doing the same for `receive.fsck.<msg-id>` and `fetch.fsck.<msg-id>`
37 will only cause git to warn.
38 ++
39 +See `Fsck Messages` section of linkgit:git-fsck[1] for supported
40 +values of `<msg-id>`.
41 +
42
43 fsck.skipList::
44 The path to a list of object names (i.e. one unabbreviated SHA-1 per
Documentation/fsck-msgids.txt new
+161
@@ -0,0 +1,161 @@
1 +`badDate`::
2 + (ERROR) Invalid date format in an author/committer line.
3 +
4 +`badDateOverflow`::
5 + (ERROR) Invalid date value in an author/committer line.
6 +
7 +`badEmail`::
8 + (ERROR) Invalid email format in an author/committer line.
9 +
10 +`badFilemode`::
11 + (INFO) A tree contains a bad filemode entry.
12 +
13 +`badName`::
14 + (ERROR) An author/committer name is empty.
15 +
16 +`badObjectSha1`::
17 + (ERROR) An object has a bad sha1.
18 +
19 +`badParentSha1`::
20 + (ERROR) A commit object has a bad parent sha1.
21 +
22 +`badTagName`::
23 + (INFO) A tag has an invalid format.
24 +
25 +`badTimezone`::
26 + (ERROR) Found an invalid time zone in an author/committer line.
27 +
28 +`badTree`::
29 + (ERROR) A tree cannot be parsed.
30 +
31 +`badTreeSha1`::
32 + (ERROR) A tree has an invalid format.
33 +
34 +`badType`::
35 + (ERROR) Found an invalid object type.
36 +
37 +`duplicateEntries`::
38 + (ERROR) A tree contains duplicate file entries.
39 +
40 +`emptyName`::
41 + (WARN) A path contains an empty name.
42 +
43 +`extraHeaderEntry`::
44 + (IGNORE) Extra headers found after `tagger`.
45 +
46 +`fullPathname`::
47 + (WARN) A path contains the full path starting with "/".
48 +
49 +`gitattributesSymlink`::
50 + (INFO) `.gitattributes` is a symlink.
51 +
52 +`gitignoreSymlink`::
53 + (INFO) `.gitignore` is a symlink.
54 +
55 +`gitmodulesBlob`::
56 + (ERROR) A non-blob found at `.gitmodules`.
57 +
58 +`gitmodulesLarge`::
59 + (ERROR) The `.gitmodules` file is too large to parse.
60 +
61 +`gitmodulesMissing`::
62 + (ERROR) Unable to read `.gitmodules` blob.
63 +
64 +`gitmodulesName`::
65 + (ERROR) A submodule name is invalid.
66 +
67 +`gitmodulesParse`::
68 + (INFO) Could not parse `.gitmodules` blob.
69 +
70 +`gitmodulesLarge`;
71 + (ERROR) `.gitmodules` blob is too large to parse.
72 +
73 +`gitmodulesPath`::
74 + (ERROR) `.gitmodules` path is invalid.
75 +
76 +`gitmodulesSymlink`::
77 + (ERROR) `.gitmodules` is a symlink.
78 +
79 +`gitmodulesUpdate`::
80 + (ERROR) Found an invalid submodule update setting.
81 +
82 +`gitmodulesUrl`::
83 + (ERROR) Found an invalid submodule url.
84 +
85 +`hasDot`::
86 + (WARN) A tree contains an entry named `.`.
87 +
88 +`hasDotdot`::
89 + (WARN) A tree contains an entry named `..`.
90 +
91 +`hasDotgit`::
92 + (WARN) A tree contains an entry named `.git`.
93 +
94 +`mailmapSymlink`::
95 + (INFO) `.mailmap` is a symlink.
96 +
97 +`missingAuthor`::
98 + (ERROR) Author is missing.
99 +
100 +`missingCommitter`::
101 + (ERROR) Committer is missing.
102 +
103 +`missingEmail`::
104 + (ERROR) Email is missing in an author/committer line.
105 +
106 +`missingNameBeforeEmail`::
107 + (ERROR) Missing name before an email in an author/committer line.
108 +
109 +`missingObject`::
110 + (ERROR) Missing `object` line in tag object.
111 +
112 +`missingSpaceBeforeDate`::
113 + (ERROR) Missing space before date in an author/committer line.
114 +
115 +`missingSpaceBeforeEmail`::
116 + (ERROR) Missing space before the email in author/committer line.
117 +
118 +`missingTag`::
119 + (ERROR) Unexpected end after `type` line in a tag object.
120 +
121 +`missingTagEntry`::
122 + (ERROR) Missing `tag` line in a tag object.
123 +
124 +`missingTaggerEntry`::
125 + (INFO) Missing `tagger` line in a tag object.
126 +
127 +`missingTree`::
128 + (ERROR) Missing `tree` line in a commit object.
129 +
130 +`missingType`::
131 + (ERROR) Invalid type value on the `type` line in a tag object.
132 +
133 +`missingTypeEntry`::
134 + (ERROR) Missing `type` line in a tag object.
135 +
136 +`multipleAuthors`::
137 + (ERROR) Multiple author lines found in a commit.
138 +
139 +`nulInCommit`::
140 + (WARN) Found a NUL byte in the commit object body.
141 +
142 +`nulInHeader`::
143 + (FATAL) NUL byte exists in the object header.
144 +
145 +`nullSha1`::
146 + (WARN) Tree contains entries pointing to a null sha1.
147 +
148 +`treeNotSorted`::
149 + (ERROR) A tree is not properly sorted.
150 +
151 +`unknownType`::
152 + (ERROR) Found an unknown object type.
153 +
154 +`unterminatedHeader`::
155 + (FATAL) Missing end-of-line in the object header.
156 +
157 +`zeroPaddedDate`::
158 + (ERROR) Found a zero padded date in an author/commiter line.
159 +
160 +`zeroPaddedFilemode`::
161 + (WARN) Found a zero padded filemode in a tree.
Documentation/git-fsck.txt
+12
@@ -152,6 +152,18 @@ hash mismatch <object>::
152 object database value.
153 This indicates a serious data integrity problem.
154
155 +
156 +FSCK MESSAGES
157 +-------------
158 +
159 +The following lists the types of errors `git fsck` detects and what
160 +each error means, with their default severity. The severity of the
161 +error, other than those that are marked as "(FATAL)", can be tweaked
162 +by setting the corresponding `fsck.<msg-id>` configuration variable.
163 +
164 +include::fsck-msgids.txt[]
165 +
166 +
167 Environment Variables
168 ---------------------
169
fsck.h
+6
@@ -13,6 +13,12 @@ enum fsck_msg_type {
13 FSCK_WARN,
14 };
15
16 +/*
17 + * Documentation/fsck-msgids.txt documents these; when
18 + * modifying this list in any way, make sure to keep the
19 + * two in sync.
20 + */
21 +
22 #define FOREACH_FSCK_MSG_ID(FUNC) \
23 /* fatal errors */ \
24 FUNC(NUL_IN_HEADER, FATAL) \