show_ref_cb(): 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:38 UTC ce2a9873297e30ad9514627bc90800280226dfd4
1 file changed +3 -5
builtin/receive-pack.c
+3 -5
@@ -197,7 +197,7 @@ static void show_ref(const char *path, const unsigned char *sha1)
197 }
198 }
199
200 -static int show_ref_cb(const char *path, const unsigned char *sha1, int flag, void *unused)
200 +static int show_ref_cb(const char *path, const struct object_id *oid, int flag, void *unused)
201 {
202 path = strip_namespace(path);
203 /*
@@ -210,7 +210,7 @@ static int show_ref_cb(const char *path, const unsigned char *sha1, int flag, vo
210 */
211 if (!path)
212 path = ".have";
213 - show_ref(path, sha1);
213 + show_ref(path, oid->hash);
214 return 0;
215 }
216
@@ -228,13 +228,11 @@ static void collect_one_alternate_ref(const struct ref *ref, void *data)
228 static void write_head_info(void)
229 {
230 struct sha1_array sa = SHA1_ARRAY_INIT;
231 - struct each_ref_fn_sha1_adapter wrapped_show_ref_cb =
232 - {show_ref_cb, NULL};
231
232 for_each_alternate_ref(collect_one_alternate_ref, &sa);
233 sha1_array_for_each_unique(&sa, show_one_alternate_sha1, NULL);
234 sha1_array_clear(&sa);
237 - for_each_ref(each_ref_fn_adapter, &wrapped_show_ref_cb);
235 + for_each_ref(show_ref_cb, NULL);
236 if (!sent_capabilities)
237 show_ref("capabilities^{}", null_sha1);
238