commit d30182290dbc8e6972ead312fee101e3708b8df6 from: Omar Polo date: Sun Feb 12 15:04:32 2023 UTC fix gotadmin/repository_admin commit - 43428b698225cb8ddfebc487046c88ddc05fe482 commit + d30182290dbc8e6972ead312fee101e3708b8df6 blob - c58c4fe44da605cb0d46618f269c572599aa09b5 blob + 243c5931f7a30fc39cd23277aabf7d50a8b915ce --- lib/repository_admin.c +++ lib/repository_admin.c @@ -485,7 +485,10 @@ got_repo_find_pack(FILE **packfile, struct got_object_ goto done; } *dot = '\0'; - if (!got_parse_sha1_digest(id.hash, p)) { + + memset(&id, 0, sizeof(id)); + id.algo = repo->algo; + if (!got_parse_hash_digest(id.hash, p, repo->algo)) { err = got_error_fmt(GOT_ERR_BAD_PATH, "'%s' is not a valid pack file name", packfile_name); @@ -530,8 +533,11 @@ got_repo_list_pack(FILE *packfile, struct got_object_i char *id_str = NULL, *idxpath = NULL, *packpath = NULL; struct got_packidx *packidx = NULL; struct got_pack *pack = NULL; + size_t idlen; uint32_t nobj, i; + idlen = got_hash_digest_length(repo->algo); + err = got_object_id_str(&id_str, pack_hash); if (err) goto done; @@ -570,9 +576,10 @@ got_repo_list_pack(FILE *packfile, struct got_object_i if (err) break; } - oid = packidx->hdr.sorted_ids + i * SHA1_DIGEST_LENGTH; + oid = packidx->hdr.sorted_ids + i * idlen; memset(&id, 0, sizeof(id)); - memcpy(id.hash, oid->hash, SHA1_DIGEST_LENGTH); + id.algo = repo->algo; + memcpy(id.hash, oid->hash, idlen); offset = got_packidx_get_object_offset(packidx, i); if (offset == -1) { @@ -687,7 +694,9 @@ get_loose_object_ids(struct got_object_idset **loose_i } memset(&id, 0, sizeof(id)); - if (!got_parse_sha1_digest(id.hash, id_str)) { + id.algo = repo->algo; + if (!got_parse_hash_digest(id.hash, id_str, + repo->algo)) { free(id_str); continue; }