Commit cedfc41a authored by brian m. carlson's avatar brian m. carlson Committed by Junio C Hamano

Convert struct ref_array_item to struct object_id

Convert struct ref_array_item to use struct object_id by changing the
definition and applying the following semantic patch, plus the standard
object_id transforms:

struct ref_array_item E1;
- E1.objectname
+ E1.objectname.hash

struct ref_array_item *E1;
- E1->objectname
+ E1->objectname.hash

This transformation allows us to convert get_obj, which is needed to
convert parse_object_buffer.
Signed-off-by: brian m. carlson's avatarbrian m. carlson <>
Signed-off-by: default avatarJunio C Hamano <>
parent 9fd75046
......@@ -1366,7 +1366,7 @@ static void populate_value(struct ref_array_item *ref)
v->s = xstrdup(buf + 1);
} else if (!deref && grab_objectname(name, ref->objectname, v, atom)) {
} else if (!deref && grab_objectname(name, ref->objectname.hash, v, atom)) {
} else if (!strcmp(name, "HEAD")) {
const char *head;
......@@ -1415,13 +1415,13 @@ static void populate_value(struct ref_array_item *ref)
buf = get_obj(ref->objectname, &obj, &size, &eaten);
buf = get_obj(ref->objectname.hash, &obj, &size, &eaten);
if (!buf)
die(_("missing object %s for %s"),
sha1_to_hex(ref->objectname), ref->refname);
oid_to_hex(&ref->objectname), ref->refname);
if (!obj)
die(_("parse_object_buffer failed on %s for %s"),
sha1_to_hex(ref->objectname), ref->refname);
oid_to_hex(&ref->objectname), ref->refname);
grab_values(ref->value, 0, obj, buf, size);
if (!eaten)
......@@ -1704,7 +1704,7 @@ static struct ref_array_item *new_ref_array_item(const char *refname,
struct ref_array_item *ref;
FLEX_ALLOC_STR(ref, refname, refname);
hashcpy(ref->objectname, objectname);
hashcpy(ref->objectname.hash, objectname);
ref->flag = flag;
return ref;
......@@ -34,7 +34,7 @@ struct ref_sorting {
struct ref_array_item {
unsigned char objectname[20];
struct object_id objectname;
int flag;
unsigned int kind;
const char *symref;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment