mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
hash: require hash algorithm in oidread() and oidclr()
Both `oidread()` and `oidclr()` use `the_repository` to derive the hash function that shall be used. Require callers to pass in the hash algorithm to get rid of this implicit dependency. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
f4836570a7
commit
9da95bda74
@@ -894,7 +894,7 @@ static int next_record(struct packed_ref_iterator *iter)
|
||||
if (!refname_is_safe(iter->base.refname))
|
||||
die("packed refname is dangerous: %s",
|
||||
iter->base.refname);
|
||||
oidclr(&iter->oid);
|
||||
oidclr(&iter->oid, the_repository->hash_algo);
|
||||
iter->base.flags |= REF_BAD_NAME | REF_ISBROKEN;
|
||||
}
|
||||
if (iter->snapshot->peeled == PEELED_FULLY ||
|
||||
@@ -919,13 +919,13 @@ static int next_record(struct packed_ref_iterator *iter)
|
||||
* we suppress it if the reference is broken:
|
||||
*/
|
||||
if ((iter->base.flags & REF_ISBROKEN)) {
|
||||
oidclr(&iter->peeled);
|
||||
oidclr(&iter->peeled, the_repository->hash_algo);
|
||||
iter->base.flags &= ~REF_KNOWS_PEELED;
|
||||
} else {
|
||||
iter->base.flags |= REF_KNOWS_PEELED;
|
||||
}
|
||||
} else {
|
||||
oidclr(&iter->peeled);
|
||||
oidclr(&iter->peeled, the_repository->hash_algo);
|
||||
}
|
||||
|
||||
return ITER_OK;
|
||||
|
||||
Reference in New Issue
Block a user