From patchwork Wed Feb 27 14:55:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 10831787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A79C7922 for ; Wed, 27 Feb 2019 14:55:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 929692CC37 for ; Wed, 27 Feb 2019 14:55:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 871B42DC2C; Wed, 27 Feb 2019 14:55:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19E2E2CC37 for ; Wed, 27 Feb 2019 14:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729993AbfB0Ozv (ORCPT ); Wed, 27 Feb 2019 09:55:51 -0500 Received: from cloud.peff.net ([104.130.231.41]:59900 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727213AbfB0Ozv (ORCPT ); Wed, 27 Feb 2019 09:55:51 -0500 Received: (qmail 3223 invoked by uid 109); 27 Feb 2019 14:55:51 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with SMTP; Wed, 27 Feb 2019 14:55:51 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 6218 invoked by uid 111); 27 Feb 2019 14:56:06 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.94) with (ECDHE-RSA-AES256-GCM-SHA384 encrypted) SMTP; Wed, 27 Feb 2019 09:56:06 -0500 Authentication-Results: peff.net; auth=none Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Wed, 27 Feb 2019 09:55:49 -0500 Date: Wed, 27 Feb 2019 09:55:49 -0500 From: Jeff King To: git@vger.kernel.org Subject: [PATCH] doc/fsck: discuss mix of --connectivity-only and --dangling Message-ID: <20190227145549.GA3255@sigill.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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