summaryrefslogtreecommitdiff
path: root/pack-objects.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-09-05 22:52:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-09-06 18:03:39 (GMT)
commitf1cbd033e201a18c7175bc6509b48d6243e79739 (patch)
tree570056d516b231b921e53f5292e0f61dc001cc66 /pack-objects.c
parent0dfed92dfdb95c2f12df7299bb1e606d79185626 (diff)
downloadgit-f1cbd033e201a18c7175bc6509b48d6243e79739.zip
git-f1cbd033e201a18c7175bc6509b48d6243e79739.tar.gz
git-f1cbd033e201a18c7175bc6509b48d6243e79739.tar.bz2
pack-objects: use object_id in packlist_alloc()
The only caller of packlist_alloc() already has a "struct object_id", and we immediately copy the hash they pass us into our own object_id. Let's avoid the unnecessary round-trip to a raw sha1 pointer. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-objects.c')
-rw-r--r--pack-objects.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pack-objects.c b/pack-objects.c
index 5256029..c1df08d 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -153,7 +153,7 @@ void prepare_packing_data(struct repository *r, struct packing_data *pdata)
}
struct object_entry *packlist_alloc(struct packing_data *pdata,
- const unsigned char *sha1,
+ const struct object_id *oid,
uint32_t index_pos)
{
struct object_entry *new_entry;
@@ -177,7 +177,7 @@ struct object_entry *packlist_alloc(struct packing_data *pdata,
new_entry = pdata->objects + pdata->nr_objects++;
memset(new_entry, 0, sizeof(*new_entry));
- hashcpy(new_entry->idx.oid.hash, sha1);
+ oidcpy(&new_entry->idx.oid, oid);
if (pdata->index_size * 3 <= pdata->nr_objects * 4)
rehash_objects(pdata);