Skip to content

Commit ac2ed0d

Browse files
bk2204gitster
authored andcommitted
refs: convert peel_object to struct object_id
Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 49e6147 commit ac2ed0d

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

refs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ static int filter_refs(const char *refname, const struct object_id *oid,
252252
return filter->fn(refname, oid, flags, filter->cb_data);
253253
}
254254

255-
enum peel_status peel_object(const unsigned char *name, unsigned char *sha1)
255+
enum peel_status peel_object(const struct object_id *name, struct object_id *oid)
256256
{
257-
struct object *o = lookup_unknown_object(name);
257+
struct object *o = lookup_unknown_object(name->hash);
258258

259259
if (o->type == OBJ_NONE) {
260-
int type = sha1_object_info(name, NULL);
260+
int type = sha1_object_info(name->hash, NULL);
261261
if (type < 0 || !object_as_type(o, type, 0))
262262
return PEEL_INVALID;
263263
}
@@ -269,7 +269,7 @@ enum peel_status peel_object(const unsigned char *name, unsigned char *sha1)
269269
if (!o)
270270
return PEEL_INVALID;
271271

272-
hashcpy(sha1, o->oid.hash);
272+
oidcpy(oid, &o->oid);
273273
return PEEL_PEELED;
274274
}
275275

@@ -1714,7 +1714,7 @@ int refs_peel_ref(struct ref_store *refs, const char *refname,
17141714
RESOLVE_REF_READING, &base, &flag))
17151715
return -1;
17161716

1717-
return peel_object(base.hash, oid->hash);
1717+
return peel_object(&base, oid);
17181718
}
17191719

17201720
int peel_ref(const char *refname, struct object_id *oid)

refs/packed-backend.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ static int packed_ref_iterator_peel(struct ref_iterator *ref_iterator,
880880
} else if ((iter->base.flags & (REF_ISBROKEN | REF_ISSYMREF))) {
881881
return -1;
882882
} else {
883-
return !!peel_object(iter->oid.hash, peeled->hash);
883+
return !!peel_object(&iter->oid, peeled);
884884
}
885885
}
886886

@@ -1220,8 +1220,8 @@ static int write_with_updates(struct packed_ref_store *refs,
12201220
i++;
12211221
} else {
12221222
struct object_id peeled;
1223-
int peel_error = peel_object(update->new_oid.hash,
1224-
peeled.hash);
1223+
int peel_error = peel_object(&update->new_oid,
1224+
&peeled);
12251225

12261226
if (write_packed_entry(out, update->refname,
12271227
update->new_oid.hash,

refs/ref-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ static int cache_ref_iterator_advance(struct ref_iterator *ref_iterator)
493493
static int cache_ref_iterator_peel(struct ref_iterator *ref_iterator,
494494
struct object_id *peeled)
495495
{
496-
return peel_object(ref_iterator->oid->hash, peeled->hash);
496+
return peel_object(ref_iterator->oid, peeled);
497497
}
498498

499499
static int cache_ref_iterator_abort(struct ref_iterator *ref_iterator)

refs/refs-internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ enum peel_status {
120120
/*
121121
* Peel the named object; i.e., if the object is a tag, resolve the
122122
* tag recursively until a non-tag is found. If successful, store the
123-
* result to sha1 and return PEEL_PEELED. If the object is not a tag
123+
* result to oid and return PEEL_PEELED. If the object is not a tag
124124
* or is not valid, return PEEL_NON_TAG or PEEL_INVALID, respectively,
125125
* and leave sha1 unchanged.
126126
*/
127-
enum peel_status peel_object(const unsigned char *name, unsigned char *sha1);
127+
enum peel_status peel_object(const struct object_id *name, struct object_id *oid);
128128

129129
/*
130130
* Copy the reflog message msg to buf, which has been allocated sufficiently

0 commit comments

Comments
 (0)