diff options
author | Jeff King <peff@peff.net> | 2017-01-16 16:25:35 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-17 12:49:41 -0800 |
commit | b4584e4f665f59f51572f479db6baf1a1cdbc03a (patch) | |
tree | 7b7a24bc811699b7b75e786916690aa429a46694 /builtin | |
parent | 1ada11ee62658ff4366d93b97995eea055827171 (diff) | |
download | git-b4584e4f665f59f51572f479db6baf1a1cdbc03a.tar.gz git-b4584e4f665f59f51572f479db6baf1a1cdbc03a.tar.xz |
fsck: report trees as dangling
After checking connectivity, fsck looks through the list of
any objects we've seen mentioned, and reports unreachable
and un-"used" ones as dangling. However, it skips any object
which is not marked as "parsed", as that is an object that
we _don't_ have (but that somebody mentioned).
Since 6e454b9a3 (clear parsed flag when we free tree
buffers, 2013-06-05), that flag can't be relied on, and the
correct method is to check the HAS_OBJ flag. The cleanup in
that commit missed this callsite, though. As a result, we
would generally fail to report dangling trees.
We never noticed because there were no tests in this area
(for trees or otherwise). Let's add some.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fsck.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c index f01b81eeb..3e67203f9 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -225,7 +225,7 @@ static void check_unreachable_object(struct object *obj) * to complain about it being unreachable (since it does * not exist). */ - if (!obj->parsed) + if (!(obj->flags & HAS_OBJ)) return; /* |