aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/git-fsck.txt
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-03-04 23:47:39 -0500
committerJunio C Hamano <gitster@pobox.com>2019-03-05 22:55:57 +0900
commit8d8c2a5aef0fd20a68271697e50412791c06d9b7 (patch)
tree84d6d495b9f3b34f0f4b2f2f0ab477bad9021743 /Documentation/git-fsck.txt
parentdf805ed6cfdc3345ce238101104c51bef5ec09e7 (diff)
downloadgit-8d8c2a5aef0fd20a68271697e50412791c06d9b7.tar.gz
fsck: always compute USED flags for unreachable objects
The --connectivity-only option avoids opening every object, and instead just marks reachable objects with a flag and compares this to the set of all objects. This strategy is discussed in more detail in 3e3f8bd608 (fsck: prepare dummy objects for --connectivity-check, 2017-01-17). This means that we report _every_ unreachable object as dangling. Whereas in a full fsck, we'd have actually opened and parsed each of those unreachable objects, marking their child objects with the USED flag, to mean "this was mentioned by another object". And thus we can report only the tip of an unreachable segment of the object graph as dangling. You can see this difference with a trivial example: tree=$(git hash-object -t tree -w /dev/null) one=$(echo one | git commit-tree $tree) two=$(echo two | git commit-tree -p $one $tree) Running `git fsck` will report only $two as dangling, but with --connectivity-only, both commits (and the tree) are reported. Likewise, using --lost-found would write all three objects. We can make --connectivity-only work like the normal case by taking a separate pass over the unreachable objects, parsing them and marking objects they refer to as USED. That still avoids parsing any blobs, though we do pay the cost to access any unreachable commits and trees (which may or may not be noticeable, depending on how many you have). If neither --dangling nor --lost-found is in effect, then we can skip this step entirely, just like we do now. That makes "--connectivity-only --no-dangling" just as fast as the current "--connectivity-only". I.e., we do the correct thing always, but you can still tweak the options to make it faster if you don't care about dangling objects. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-fsck.txt')
-rw-r--r--Documentation/git-fsck.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/Documentation/git-fsck.txt b/Documentation/git-fsck.txt
index b2a32d57c8..f467119082 100644
--- a/Documentation/git-fsck.txt
+++ b/Documentation/git-fsck.txt
@@ -69,6 +69,10 @@ index file, all SHA-1 references in `refs` namespace, and all reflogs
exist). This will detect corruption in commits and trees, but
not do any semantic checks (e.g., for format errors). Corruption
in blob objects will not be detected at all.
++
+Unreachable tags, commits, and trees will also be accessed to find the
+tips of dangling segments of history. Use `--no-dangling` if you don't
+care about this output and want to speed it up further.
--strict::
Enable more strict checking, namely to catch a file mode