Use the final_oid_fn to finalize hashing of object IDs
When we're hashing a value which is going to be an object ID, we want to zero-pad that value if necessary. To do so, use the final_oid_fn instead of the final_fn anytime we're going to create an object ID to ensure we perform this operation. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
ab795f0d77
commit
5951bf467e
@ -940,7 +940,7 @@ static int store_object(
|
||||
the_hash_algo->init_fn(&c);
|
||||
the_hash_algo->update_fn(&c, hdr, hdrlen);
|
||||
the_hash_algo->update_fn(&c, dat->buf, dat->len);
|
||||
the_hash_algo->final_fn(oid.hash, &c);
|
||||
the_hash_algo->final_oid_fn(&oid, &c);
|
||||
if (oidout)
|
||||
oidcpy(oidout, &oid);
|
||||
|
||||
@ -1136,7 +1136,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
|
||||
}
|
||||
}
|
||||
git_deflate_end(&s);
|
||||
the_hash_algo->final_fn(oid.hash, &c);
|
||||
the_hash_algo->final_oid_fn(&oid, &c);
|
||||
|
||||
if (oidout)
|
||||
oidcpy(oidout, &oid);
|
||||
|
Reference in New Issue
Block a user