Merge git://git2.kernel.org/pub/scm/gitk/gitk
[gitweb.git] / tree.c
diff --git a/tree.c b/tree.c
index b6f02fecc46ec4633dc1ee75f38bc90761a4fbe3..24f8fb676650ff0c95baffe79966219fa026f09f 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -153,10 +153,8 @@ static void track_tree_refs(struct tree *item)
        /* Count how many entries there are.. */
        desc.buf = item->buffer;
        desc.size = item->size;
-       while (desc.size) {
+       while (tree_entry(&desc, &entry))
                n_refs++;
-               update_tree_entry(&desc);
-       }
 
        /* Allocate object refs and walk it again.. */
        i = 0;
@@ -190,17 +188,17 @@ int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
 
 int parse_tree(struct tree *item)
 {
-        char type[20];
+        enum object_type type;
         void *buffer;
         unsigned long size;
 
        if (item->object.parsed)
                return 0;
-       buffer = read_sha1_file(item->object.sha1, type, &size);
+       buffer = read_sha1_file(item->object.sha1, &type, &size);
        if (!buffer)
                return error("Could not read %s",
                             sha1_to_hex(item->object.sha1));
-       if (strcmp(type, tree_type)) {
+       if (type != OBJ_TREE) {
                free(buffer);
                return error("Object %s not a tree",
                             sha1_to_hex(item->object.sha1));