OSDN Git Service

merge original branch.
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseGit / git_doc / git-fsck.html.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-fsck(1)">\r
5 <articleinfo>\r
6     <title>git-fsck(1)</title>\r
7         <indexterm>\r
8                 <primary>git-fsck(1)</primary>\r
9         </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-fsck - Verifies the connectivity and validity of the objects in the database</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <blockquote>\r
18 <literallayout><emphasis>git fsck</emphasis> [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\r
19          [--full] [--strict] [--verbose] [--lost-found] [&lt;object&gt;*]</literallayout>\r
20 </blockquote>\r
21 </simplesect>\r
22 <simplesect id="_description">\r
23 <title>DESCRIPTION</title>\r
24 <simpara>Verifies the connectivity and validity of the objects in the database.</simpara>\r
25 </simplesect>\r
26 <simplesect id="_options">\r
27 <title>OPTIONS</title>\r
28 <variablelist>\r
29 <varlistentry>\r
30 <term>\r
31 &lt;object&gt;\r
32 </term>\r
33 <listitem>\r
34 <simpara>\r
35         An object to treat as the head of an unreachability trace.\r
36 </simpara>\r
37 <simpara>If no objects are given, <emphasis>git-fsck</emphasis> defaults to using the\r
38 index file, all SHA1 references in .git/refs/*, and all reflogs (unless\r
39 --no-reflogs is given) as heads.</simpara>\r
40 </listitem>\r
41 </varlistentry>\r
42 <varlistentry>\r
43 <term>\r
44 --unreachable\r
45 </term>\r
46 <listitem>\r
47 <simpara>\r
48         Print out objects that exist but that aren&#8217;t readable from any\r
49         of the reference nodes.\r
50 </simpara>\r
51 </listitem>\r
52 </varlistentry>\r
53 <varlistentry>\r
54 <term>\r
55 --root\r
56 </term>\r
57 <listitem>\r
58 <simpara>\r
59         Report root nodes.\r
60 </simpara>\r
61 </listitem>\r
62 </varlistentry>\r
63 <varlistentry>\r
64 <term>\r
65 --tags\r
66 </term>\r
67 <listitem>\r
68 <simpara>\r
69         Report tags.\r
70 </simpara>\r
71 </listitem>\r
72 </varlistentry>\r
73 <varlistentry>\r
74 <term>\r
75 --cache\r
76 </term>\r
77 <listitem>\r
78 <simpara>\r
79         Consider any object recorded in the index also as a head node for\r
80         an unreachability trace.\r
81 </simpara>\r
82 </listitem>\r
83 </varlistentry>\r
84 <varlistentry>\r
85 <term>\r
86 --no-reflogs\r
87 </term>\r
88 <listitem>\r
89 <simpara>\r
90         Do not consider commits that are referenced only by an\r
91         entry in a reflog to be reachable.  This option is meant\r
92         only to search for commits that used to be in a ref, but\r
93         now aren&#8217;t, but are still in that corresponding reflog.\r
94 </simpara>\r
95 </listitem>\r
96 </varlistentry>\r
97 <varlistentry>\r
98 <term>\r
99 --full\r
100 </term>\r
101 <listitem>\r
102 <simpara>\r
103         Check not just objects in GIT_OBJECT_DIRECTORY\r
104         ($GIT_DIR/objects), but also the ones found in alternate\r
105         object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES\r
106         or $GIT_DIR/objects/info/alternates,\r
107         and in packed git archives found in $GIT_DIR/objects/pack\r
108         and corresponding pack subdirectories in alternate\r
109         object pools.\r
110 </simpara>\r
111 </listitem>\r
112 </varlistentry>\r
113 <varlistentry>\r
114 <term>\r
115 --strict\r
116 </term>\r
117 <listitem>\r
118 <simpara>\r
119         Enable more strict checking, namely to catch a file mode\r
120         recorded with g+w bit set, which was created by older\r
121         versions of git.  Existing repositories, including the\r
122         Linux kernel, git itself, and sparse repository have old\r
123         objects that triggers this check, but it is recommended\r
124         to check new projects with this flag.\r
125 </simpara>\r
126 </listitem>\r
127 </varlistentry>\r
128 <varlistentry>\r
129 <term>\r
130 --verbose\r
131 </term>\r
132 <listitem>\r
133 <simpara>\r
134         Be chatty.\r
135 </simpara>\r
136 </listitem>\r
137 </varlistentry>\r
138 <varlistentry>\r
139 <term>\r
140 --lost-found\r
141 </term>\r
142 <listitem>\r
143 <simpara>\r
144         Write dangling objects into .git/lost-found/commit/ or\r
145         .git/lost-found/other/, depending on type.  If the object is\r
146         a blob, the contents are written into the file, rather than\r
147         its object name.\r
148 </simpara>\r
149 </listitem>\r
150 </varlistentry>\r
151 </variablelist>\r
152 <simpara>It tests SHA1 and general object sanity, and it does full tracking of\r
153 the resulting reachability and everything else. It prints out any\r
154 corruption it finds (missing or bad objects), and if you use the\r
155 <emphasis>--unreachable</emphasis> flag it will also print out objects that exist but\r
156 that aren&#8217;t readable from any of the specified head nodes.</simpara>\r
157 <simpara>So for example</simpara>\r
158 <literallayout class="monospaced">git fsck --unreachable HEAD \\r
159         $(git for-each-ref --format="%(objectname)" refs/heads)</literallayout>\r
160 <simpara>will do quite a <emphasis>lot</emphasis> of verification on the tree. There are a few\r
161 extra validity tests to be added (make sure that tree objects are\r
162 sorted properly etc), but on the whole if <emphasis>git-fsck</emphasis> is happy, you\r
163 do have a valid tree.</simpara>\r
164 <simpara>Any corrupt objects you will have to find in backups or other archives\r
165 (i.e., you can just remove them and do an <emphasis>rsync</emphasis> with some other site in\r
166 the hopes that somebody else has the object you have corrupted).</simpara>\r
167 <simpara>Of course, "valid tree" doesn&#8217;t mean that it wasn&#8217;t generated by some\r
168 evil person, and the end result might be crap. git is a revision\r
169 tracking system, not a quality assurance system ;)</simpara>\r
170 </simplesect>\r
171 <simplesect id="_extracted_diagnostics">\r
172 <title>Extracted Diagnostics</title>\r
173 <variablelist>\r
174 <varlistentry>\r
175 <term>\r
176 expect dangling commits - potential heads - due to lack of head information\r
177 </term>\r
178 <listitem>\r
179 <simpara>\r
180         You haven&#8217;t specified any nodes as heads so it won&#8217;t be\r
181         possible to differentiate between un-parented commits and\r
182         root nodes.\r
183 </simpara>\r
184 </listitem>\r
185 </varlistentry>\r
186 <varlistentry>\r
187 <term>\r
188 missing sha1 directory <emphasis>&lt;dir&gt;</emphasis>\r
189 </term>\r
190 <listitem>\r
191 <simpara>\r
192         The directory holding the sha1 objects is missing.\r
193 </simpara>\r
194 </listitem>\r
195 </varlistentry>\r
196 <varlistentry>\r
197 <term>\r
198 unreachable &lt;type&gt; &lt;object&gt;\r
199 </term>\r
200 <listitem>\r
201 <simpara>\r
202         The &lt;type&gt; object &lt;object&gt;, isn&#8217;t actually referred to directly\r
203         or indirectly in any of the trees or commits seen. This can\r
204         mean that there&#8217;s another root node that you&#8217;re not specifying\r
205         or that the tree is corrupt. If you haven&#8217;t missed a root node\r
206         then you might as well delete unreachable nodes since they\r
207         can&#8217;t be used.\r
208 </simpara>\r
209 </listitem>\r
210 </varlistentry>\r
211 <varlistentry>\r
212 <term>\r
213 missing &lt;type&gt; &lt;object&gt;\r
214 </term>\r
215 <listitem>\r
216 <simpara>\r
217         The &lt;type&gt; object &lt;object&gt;, is referred to but isn&#8217;t present in\r
218         the database.\r
219 </simpara>\r
220 </listitem>\r
221 </varlistentry>\r
222 <varlistentry>\r
223 <term>\r
224 dangling &lt;type&gt; &lt;object&gt;\r
225 </term>\r
226 <listitem>\r
227 <simpara>\r
228         The &lt;type&gt; object &lt;object&gt;, is present in the database but never\r
229         <emphasis>directly</emphasis> used. A dangling commit could be a root node.\r
230 </simpara>\r
231 </listitem>\r
232 </varlistentry>\r
233 <varlistentry>\r
234 <term>\r
235 warning: git-fsck: tree &lt;tree&gt; has full pathnames in it\r
236 </term>\r
237 <listitem>\r
238 <simpara>\r
239         And it shouldn&#8217;t&#8230;\r
240 </simpara>\r
241 </listitem>\r
242 </varlistentry>\r
243 <varlistentry>\r
244 <term>\r
245 sha1 mismatch &lt;object&gt;\r
246 </term>\r
247 <listitem>\r
248 <simpara>\r
249         The database has an object who&#8217;s sha1 doesn&#8217;t match the\r
250         database value.\r
251         This indicates a serious data integrity problem.\r
252 </simpara>\r
253 </listitem>\r
254 </varlistentry>\r
255 </variablelist>\r
256 </simplesect>\r
257 <simplesect id="_environment_variables">\r
258 <title>Environment Variables</title>\r
259 <variablelist>\r
260 <varlistentry>\r
261 <term>\r
262 GIT_OBJECT_DIRECTORY\r
263 </term>\r
264 <listitem>\r
265 <simpara>\r
266         used to specify the object database root (usually $GIT_DIR/objects)\r
267 </simpara>\r
268 </listitem>\r
269 </varlistentry>\r
270 <varlistentry>\r
271 <term>\r
272 GIT_INDEX_FILE\r
273 </term>\r
274 <listitem>\r
275 <simpara>\r
276         used to specify the index file of the index\r
277 </simpara>\r
278 </listitem>\r
279 </varlistentry>\r
280 <varlistentry>\r
281 <term>\r
282 GIT_ALTERNATE_OBJECT_DIRECTORIES\r
283 </term>\r
284 <listitem>\r
285 <simpara>\r
286         used to specify additional object database roots (usually unset)\r
287 </simpara>\r
288 </listitem>\r
289 </varlistentry>\r
290 </variablelist>\r
291 </simplesect>\r
292 <simplesect id="_author">\r
293 <title>Author</title>\r
294 <simpara>Written by Linus Torvalds &lt;<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>&gt;</simpara>\r
295 </simplesect>\r
296 <simplesect id="_documentation">\r
297 <title>Documentation</title>\r
298 <simpara>Documentation by David Greaves, Junio C Hamano and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>\r
299 </simplesect>\r
300 <simplesect id="_git">\r
301 <title>GIT</title>\r
302 <simpara>Part of the <xref linkend="git(1)"/> suite</simpara>\r
303 </simplesect>\r
304 </article>\r