git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH] doc/fsck: discuss mix of --connectivity-only and --dangling
Date: Wed, 27 Feb 2019 09:55:49 -0500	[thread overview]
Message-ID: <20190227145549.GA3255@sigill.intra.peff.net> (raw)

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.

We could make the two cases work identically by taking a separate pass
over the unreachable objects, parsing them and marking objects they
refer to as USED. That would still avoid parsing any blobs, but we'd pay
the cost to access any unreachable commits and trees. Since the point of
--connectivity-only is to quickly report whether all reachable objects
are present, I'd argue that it's not worth slowing it down to produce
a better-analyzed dangling list.

Instead, let's document this somewhat surprising property of
connectivity-only. If somebody really wants to the extra analysis, we
can add a separate option to enable it.

Signed-off-by: Jeff King <peff@peff.net>
---
 Documentation/git-fsck.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/git-fsck.txt b/Documentation/git-fsck.txt
index 55950d9eea..02ce7c6282 100644
--- a/Documentation/git-fsck.txt
+++ b/Documentation/git-fsck.txt
@@ -65,6 +65,10 @@ index file, all SHA-1 references in `refs` namespace, and all reflogs
 	Check only the connectivity of tags, commits and tree objects. By
 	avoiding to unpack blobs, this speeds up the operation, at the
 	expense of missing corrupt objects or other problematic issues.
+	Note that this also skips some analysis of unreachable objects,
+	meaning that Git will report the full list of unreachable
+	objects as dangling (unless `--no-dangling` was used), rather
+	than the tips of unreachable segments of history.
 
 --strict::
 	Enable more strict checking, namely to catch a file mode
-- 
2.21.0.675.g01c085a870

             reply	other threads:[~2019-02-27 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 14:55 Jeff King [this message]
2019-02-27 14:59 ` [PATCH] doc/fsck: discuss mix of --connectivity-only and --dangling Jeff King
2019-03-01  2:50   ` Junio C Hamano
2019-03-05  4:26     ` Jeff King
2019-03-05  4:45       ` [PATCH v2 0/2] fsck --connectivity-only --dangling Jeff King
2019-03-05  4:46         ` [PATCH v2 1/2] doc/fsck: clarify --connectivity-only behavior Jeff King
2019-03-05  4:47         ` [PATCH v2 2/2] fsck: always compute USED flags for unreachable objects Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190227145549.GA3255@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).