odb_hash*: accept the oid type to hash into

The git_odb_hash helper functions should not assume SHA1, and instead
should be given the oid type that they're producing.
This commit is contained in:
Edward Thomson
2022-01-26 13:07:28 -05:00
parent c50b280fa5
commit 8444b6dce7
16 changed files with 136 additions and 79 deletions

View File

@@ -90,7 +90,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
if (git_indexer_append(indexer, data, size, &stats) < 0)
goto cleanup;
if (append_hash) {
if (git_odb_hash(&oid, data, size, GIT_OBJECT_BLOB) < 0) {
if (git_odb_hash(&oid, data, size, GIT_OBJECT_BLOB, GIT_OID_SHA1) < 0) {
fprintf(stderr, "Failed to compute the SHA1 hash\n");
abort();
}