reachable: use revision machinery's --indexed-objects code

This does the same thing as our custom code, so let's not repeat ourselves. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 16, 2014 at 20:44 UTC 1be111d88f526130dcf3b7c7ad0f5df17c6d2bae
1 file changed +1 -51
reachable.c
+1 -51
@@ -32,56 +32,6 @@ static int add_one_ref(const char *path, const unsigned char *sha1, int flag, vo
32 return 0;
33 }
34
35 -static void add_one_tree(const unsigned char *sha1, struct rev_info *revs)
36 -{
37 - struct tree *tree = lookup_tree(sha1);
38 - if (tree)
39 - add_pending_object(revs, &tree->object, "");
40 -}
41 -
42 -static void add_cache_tree(struct cache_tree *it, struct rev_info *revs)
43 -{
44 - int i;
45 -
46 - if (it->entry_count >= 0)
47 - add_one_tree(it->sha1, revs);
48 - for (i = 0; i < it->subtree_nr; i++)
49 - add_cache_tree(it->down[i]->cache_tree, revs);
50 -}
51 -
52 -static void add_cache_refs(struct rev_info *revs)
53 -{
54 - int i;
55 -
56 - read_cache();
57 - for (i = 0; i < active_nr; i++) {
58 - struct blob *blob;
59 -
60 - /*
61 - * The index can contain blobs and GITLINKs, GITLINKs are hashes
62 - * that don't actually point to objects in the repository, it's
63 - * almost guaranteed that they are NOT blobs, so we don't call
64 - * lookup_blob() on them, to avoid populating the hash table
65 - * with invalid information
66 - */
67 - if (S_ISGITLINK(active_cache[i]->ce_mode))
68 - continue;
69 -
70 - blob = lookup_blob(active_cache[i]->sha1);
71 - if (blob)
72 - blob->object.flags |= SEEN;
73 -
74 - /*
75 - * We could add the blobs to the pending list, but quite
76 - * frankly, we don't care. Once we've looked them up, and
77 - * added them as objects, we've really done everything
78 - * there is to do for a blob
79 - */
80 - }
81 - if (active_cache_tree)
82 - add_cache_tree(active_cache_tree, revs);
83 -}
84 -
35 /*
36 * The traversal will have already marked us as SEEN, so we
37 * only need to handle any progress reporting here.
@@ -213,7 +163,7 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog,
163 revs->tree_objects = 1;
164
165 /* Add all refs from the index file */
216 - add_cache_refs(revs);
166 + add_index_objects_to_pending(revs, 0);
167
168 /* Add all external refs */
169 for_each_ref(add_one_ref, revs);