add_info_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
e2b0bcdf4a1106342dd443b7f86aef63bbe54897
1 file changed
+5
-7
server-info.c
+5
-7
@@ -47,14 +47,15 @@ out:
47
return ret;
48
}
49
50
-static int add_info_ref(const char *path, const unsigned char *sha1, int flag, void *cb_data)
50
+static int add_info_ref(const char *path, const struct object_id *oid,
51
+ int flag, void *cb_data)
52
{
53
FILE *fp = cb_data;
53
- struct object *o = parse_object(sha1);
54
+ struct object *o = parse_object(oid->hash);
55
if (!o)
56
return -1;
57
57
- if (fprintf(fp, "%s %s\n", sha1_to_hex(sha1), path) < 0)
58
+ if (fprintf(fp, "%s %s\n", oid_to_hex(oid), path) < 0)
59
return -1;
60
61
if (o->type == OBJ_TAG) {
@@ -69,10 +70,7 @@ static int add_info_ref(const char *path, const unsigned char *sha1, int flag, v
70
71
static int generate_info_refs(FILE *fp)
72
{
72
- struct each_ref_fn_sha1_adapter wrapped_add_info_ref =
73
- {add_info_ref, fp};
74
-
75
- return for_each_ref(each_ref_fn_adapter, &wrapped_add_info_ref);
73
+ return for_each_ref(add_info_ref, fp);
74
}
75
76
static int update_info_refs(int force)