ref-filter: convert grab_objectname to struct object_id

This is necessary in order to convert find_unique_abbrev. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Mar 12, 2018 at 02:27 UTC 1776979573fa150cfad850f73ab4109d245ad210
1 file changed +6 -6
ref-filter.c
+6 -6
@@ -737,18 +737,18 @@ static void *get_obj(const struct object_id *oid, struct object **obj, unsigned
737 return buf;
738 }
739
740 -static int grab_objectname(const char *name, const unsigned char *sha1,
740 +static int grab_objectname(const char *name, const struct object_id *oid,
741 struct atom_value *v, struct used_atom *atom)
742 {
743 if (starts_with(name, "objectname")) {
744 if (atom->u.objectname.option == O_SHORT) {
745 - v->s = xstrdup(find_unique_abbrev(sha1, DEFAULT_ABBREV));
745 + v->s = xstrdup(find_unique_abbrev(oid->hash, DEFAULT_ABBREV));
746 return 1;
747 } else if (atom->u.objectname.option == O_FULL) {
748 - v->s = xstrdup(sha1_to_hex(sha1));
748 + v->s = xstrdup(oid_to_hex(oid));
749 return 1;
750 } else if (atom->u.objectname.option == O_LENGTH) {
751 - v->s = xstrdup(find_unique_abbrev(sha1, atom->u.objectname.length));
751 + v->s = xstrdup(find_unique_abbrev(oid->hash, atom->u.objectname.length));
752 return 1;
753 } else
754 die("BUG: unknown %%(objectname) option");
@@ -775,7 +775,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
775 v->s = xstrfmt("%lu", sz);
776 }
777 else if (deref)
778 - grab_objectname(name, obj->oid.hash, v, &used_atom[i]);
778 + grab_objectname(name, &obj->oid, v, &used_atom[i]);
779 }
780 }
781
@@ -1455,7 +1455,7 @@ static void populate_value(struct ref_array_item *ref)
1455 v->s = xstrdup(buf + 1);
1456 }
1457 continue;
1458 - } else if (!deref && grab_objectname(name, ref->objectname.hash, v, atom)) {
1458 + } else if (!deref && grab_objectname(name, &ref->objectname, v, atom)) {
1459 continue;
1460 } else if (!strcmp(name, "HEAD")) {
1461 if (atom->u.head && !strcmp(ref->refname, atom->u.head))