pack-objects: convert oe_set_delta_ext() to use object_id
We already store an object_id internally, and now our sole caller also has one. Let's stop passing around the internal hash array, which adds a bit of type safety. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Feb 23, 2020 at 23:30 UTC
a93c141ddef25dc999fff73c590b42d3af606ff3
3 files changed
+4
-4
builtin/pack-objects.c
+1
-1
@@ -1756,7 +1756,7 @@ static void check_object(struct object_entry *entry)
1756
entry->delta_sibling_idx = base_entry->delta_child_idx;
1757
SET_DELTA_CHILD(base_entry, entry);
1758
} else {
1759
- SET_DELTA_EXT(entry, base_ref.hash);
1759
+ SET_DELTA_EXT(entry, &base_ref);
1760
}
1761
1762
unuse_pack(&w_curs);
pack-objects.c
+2
-2
@@ -203,14 +203,14 @@ struct object_entry *packlist_alloc(struct packing_data *pdata,
203
204
void oe_set_delta_ext(struct packing_data *pdata,
205
struct object_entry *delta,
206
- const unsigned char *sha1)
206
+ const struct object_id *oid)
207
{
208
struct object_entry *base;
209
210
ALLOC_GROW(pdata->ext_bases, pdata->nr_ext + 1, pdata->alloc_ext);
211
base = &pdata->ext_bases[pdata->nr_ext++];
212
memset(base, 0, sizeof(*base));
213
- hashcpy(base->idx.oid.hash, sha1);
213
+ oidcpy(&base->idx.oid, oid);
214
215
/* These flags mark that we are not part of the actual pack output. */
216
base->preferred_base = 1;
pack-objects.h
+1
-1
@@ -292,7 +292,7 @@ static inline void oe_set_delta(struct packing_data *pack,
292
293
void oe_set_delta_ext(struct packing_data *pack,
294
struct object_entry *e,
295
- const unsigned char *sha1);
295
+ const struct object_id *oid);
296
297
static inline struct object_entry *oe_delta_child(
298
const struct packing_data *pack,