summaryrefslogtreecommitdiff
path: root/ref-filter.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-05-06 22:10:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-08 06:12:58 (GMT)
commit9850fe5d95ac14585998e6ebeaf158c976954b1b (patch)
tree54bec4502a029e37280c300b0e569e0709d49d2c /ref-filter.c
parentcedfc41ac62c691557263a8db41f7f693914d68d (diff)
downloadgit-9850fe5d95ac14585998e6ebeaf158c976954b1b.zip
git-9850fe5d95ac14585998e6ebeaf158c976954b1b.tar.gz
git-9850fe5d95ac14585998e6ebeaf158c976954b1b.tar.bz2
ref-filter: convert some static functions to struct object_id
Among the converted functions is a caller of parse_object_buffer, which we will convert later. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.c')
-rw-r--r--ref-filter.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ref-filter.c b/ref-filter.c
index 77aee27..56fc990 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -677,13 +677,13 @@ int verify_ref_format(const char *format)
* by the "struct object" representation, set *eaten as well---it is a
* signal from parse_object_buffer to us not to free the buffer.
*/
-static void *get_obj(const unsigned char *sha1, struct object **obj, unsigned long *sz, int *eaten)
+static void *get_obj(const struct object_id *oid, struct object **obj, unsigned long *sz, int *eaten)
{
enum object_type type;
- void *buf = read_sha1_file(sha1, &type, sz);
+ void *buf = read_sha1_file(oid->hash, &type, sz);
if (buf)
- *obj = parse_object_buffer(sha1, type, *sz, buf, eaten);
+ *obj = parse_object_buffer(oid->hash, type, *sz, buf, eaten);
else
*obj = NULL;
return buf;
@@ -1293,7 +1293,7 @@ static void populate_value(struct ref_array_item *ref)
struct object *obj;
int eaten, i;
unsigned long size;
- const unsigned char *tagged;
+ const struct object_id *tagged;
ref->value = xcalloc(used_atom_cnt, sizeof(struct atom_value));
@@ -1370,10 +1370,10 @@ static void populate_value(struct ref_array_item *ref)
continue;
} else if (!strcmp(name, "HEAD")) {
const char *head;
- unsigned char sha1[20];
+ struct object_id oid;
head = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
- sha1, NULL);
+ oid.hash, NULL);
if (head && !strcmp(ref->refname, head))
v->s = "*";
else
@@ -1415,7 +1415,7 @@ static void populate_value(struct ref_array_item *ref)
return;
need_obj:
- buf = get_obj(ref->objectname.hash, &obj, &size, &eaten);
+ buf = get_obj(&ref->objectname, &obj, &size, &eaten);
if (!buf)
die(_("missing object %s for %s"),
oid_to_hex(&ref->objectname), ref->refname);
@@ -1438,7 +1438,7 @@ static void populate_value(struct ref_array_item *ref)
* If it is a tag object, see if we use a value that derefs
* the object, and if we do grab the object it refers to.
*/
- tagged = ((struct tag *)obj)->tagged->oid.hash;
+ tagged = &((struct tag *)obj)->tagged->oid;
/*
* NEEDSWORK: This derefs tag only once, which
@@ -1449,10 +1449,10 @@ static void populate_value(struct ref_array_item *ref)
buf = get_obj(tagged, &obj, &size, &eaten);
if (!buf)
die(_("missing object %s for %s"),
- sha1_to_hex(tagged), ref->refname);
+ oid_to_hex(tagged), ref->refname);
if (!obj)
die(_("parse_object_buffer failed on %s for %s"),
- sha1_to_hex(tagged), ref->refname);
+ oid_to_hex(tagged), ref->refname);
grab_values(ref->value, 1, obj, buf, size);
if (!eaten)
free(buf);