add_one_ref(): rewrite to take an object_id argument

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed May 25, 2015 at 18:39 UTC 635170f2bb34116441b562a93d3ce37ae4373ecc
1 file changed +5 -6
reachable.c
+5 -6
@@ -22,9 +22,10 @@ static void update_progress(struct connectivity_progress *cp)
22 display_progress(cp->progress, cp->count);
23 }
24
25 -static int add_one_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
25 +static int add_one_ref(const char *path, const struct object_id *oid,
26 + int flag, void *cb_data)
27 {
27 - struct object *object = parse_object_or_die(sha1, path);
28 + struct object *object = parse_object_or_die(oid->hash, path);
29 struct rev_info *revs = (struct rev_info *)cb_data;
30
31 add_pending_object(revs, object, "");
@@ -155,8 +156,6 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog,
156 struct progress *progress)
157 {
158 struct connectivity_progress cp;
158 - struct each_ref_fn_sha1_adapter wrapped_add_one_ref =
159 - {add_one_ref, revs};
159
160 /*
161 * Set up revision parsing, and mark us as being interested
@@ -170,10 +169,10 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog,
169 add_index_objects_to_pending(revs, 0);
170
171 /* Add all external refs */
173 - for_each_ref(each_ref_fn_adapter, &wrapped_add_one_ref);
172 + for_each_ref(add_one_ref, revs);
173
174 /* detached HEAD is not included in the list above */
176 - head_ref(each_ref_fn_adapter, &wrapped_add_one_ref);
175 + head_ref(add_one_ref, revs);
176
177 /* Add all reflog info */
178 if (mark_reflog)