]> git.ipfire.org Git - thirdparty/git.git/commit - oid-array.c
oid-array: teach oid-array to handle multiple kinds of oids
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 2 Oct 2023 02:40:06 +0000 (21:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Oct 2023 21:57:38 +0000 (14:57 -0700)
commitd50cbe4a5d989c454c620cbaa0c64a06a4a2f9a2
tree7107b01f91721267c31652737d50906440d3c8d8
parent5e9d802a33ef2912a04984d431defe9809c809e1
oid-array: teach oid-array to handle multiple kinds of oids

While looking at how to handle input of both SHA-1 and SHA-256 oids in
get_oid_with_context, I realized that the oid_array in
repo_for_each_abbrev might have more than one kind of oid stored in it
simultaneously.

Update to oid_array_append to ensure that oids added to an oid array
always have an algorithm set.

Update void_hashcmp to first verify two oids use the same hash algorithm
before comparing them to each other.

With that oid-array should be safe to use with different kinds of
oids simultaneously.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
oid-array.c