add_ref_decoration(): 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 f124b7302353fb38f39bf4b44fd8bb0fc950c7d1
1 file changed +5 -6
log-tree.c
+5 -6
@@ -89,7 +89,8 @@ const struct name_decoration *get_name_decoration(const struct object *obj)
89 return lookup_decoration(&name_decoration, obj);
90 }
91
92 -static int add_ref_decoration(const char *refname, const unsigned char *sha1, int flags, void *cb_data)
92 +static int add_ref_decoration(const char *refname, const struct object_id *oid,
93 + int flags, void *cb_data)
94 {
95 struct object *obj;
96 enum decoration_type type = DECORATION_NONE;
@@ -110,7 +111,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
111 return 0;
112 }
113
113 - obj = parse_object(sha1);
114 + obj = parse_object(oid->hash);
115 if (!obj)
116 return 0;
117
@@ -149,13 +150,11 @@ static int add_graft_decoration(const struct commit_graft *graft, void *cb_data)
150 void load_ref_decorations(int flags)
151 {
152 if (!decoration_loaded) {
152 - struct each_ref_fn_sha1_adapter wrapped_add_ref_decoration =
153 - {add_ref_decoration, NULL};
153
154 decoration_loaded = 1;
155 decoration_flags = flags;
157 - for_each_ref(each_ref_fn_adapter, &wrapped_add_ref_decoration);
158 - head_ref(each_ref_fn_adapter, &wrapped_add_ref_decoration);
156 + for_each_ref(add_ref_decoration, NULL);
157 + head_ref(add_ref_decoration, NULL);
158 for_each_commit_graft(add_graft_decoration, NULL);
159 }
160 }