test-dump-cache-tree: invalid trees are not errors
authorDavid Turner <dturner@twopensource.com>
Tue, 8 Jul 2014 00:33:43 +0000 (17:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Jul 2014 17:35:11 +0000 (10:35 -0700)
Do not treat known-invalid trees as errors even when their subtree_nr is
incorrect. Because git already knows that these trees are invalid,
an incorrect subtree_nr will not cause problems.

Add a couple of comments.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
test-dump-cache-tree.c
index 47eab9765f5cd172ca630b2a632a92d123354442..cbbbd8e41222da715ae272008c480426dead367f 100644 (file)
@@ -26,16 +26,16 @@ static int dump_cache_tree(struct cache_tree *it,
                return 0;
 
        if (it->entry_count < 0) {
+               /* invalid */
                dump_one(it, pfx, "");
                dump_one(ref, pfx, "#(ref) ");
-               if (it->subtree_nr != ref->subtree_nr)
-                       errs = 1;
        }
        else {
                dump_one(it, pfx, "");
                if (hashcmp(it->sha1, ref->sha1) ||
                    ref->entry_count != it->entry_count ||
                    ref->subtree_nr != it->subtree_nr) {
+                       /* claims to be valid but is lying */
                        dump_one(ref, pfx, "#(ref) ");
                        errs = 1;
                }