summaryrefslogtreecommitdiff
path: root/fsck-objects.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-04-25 22:51:01 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-04-25 22:51:01 -0700
commita77ada62a1f84651f56a63eec9ef138e2c1792b9 (patch)
tree52f56080155ed9853b63ec6c3941197aac79ce29 /fsck-objects.c
parentMerge branch 'pb/config' into next (diff)
parenttest-dump-cache-tree: report number of subtrees. (diff)
downloadtgif-a77ada62a1f84651f56a63eec9ef138e2c1792b9.tar.xz
Merge branch 'jc/cache-tree' into next
* jc/cache-tree: test-dump-cache-tree: report number of subtrees. cache-tree: sort the subtree entries. Teach fsck-objects about cache-tree.
Diffstat (limited to 'fsck-objects.c')
-rw-r--r--fsck-objects.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fsck-objects.c b/fsck-objects.c
index 59b25904cb..cc09143a92 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -8,6 +8,7 @@
#include "tag.h"
#include "refs.h"
#include "pack.h"
+#include "cache-tree.h"
#define REACHABLE 0x0001
@@ -438,6 +439,21 @@ static int fsck_head_link(void)
return 0;
}
+static int fsck_cache_tree(struct cache_tree *it)
+{
+ int i;
+ int err = 0;
+
+ if (0 <= it->entry_count) {
+ struct object *obj = parse_object(it->sha1);
+ if (obj->type != tree_type)
+ err |= objerror(obj, "non-tree in cache-tree");
+ }
+ for (i = 0; i < it->subtree_nr; i++)
+ err |= fsck_cache_tree(it->down[i]->cache_tree);
+ return err;
+}
+
int main(int argc, char **argv)
{
int i, heads;
@@ -547,6 +563,8 @@ int main(int argc, char **argv)
obj->used = 1;
mark_reachable(obj, REACHABLE);
}
+ if (active_cache_tree)
+ fsck_cache_tree(active_cache_tree);
}
check_connectivity();