replace-object: use hash algorithm from passed-in repository
In `register_replace_ref()`, we pass in a repository but then use `get_oid_hex()` to parse passed-in object IDs, which implicitly uses `the_repository`. Fix this by using the hash algorithm from the passed-in repository instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Jun 14, 2024 at 08:50 UTC
99cf4d6d35c7e98dde958e75ff39cd01f2088506
1 file changed
+1
-1
replace-object.c
+1
-1
@@ -20,7 +20,7 @@ static int register_replace_ref(const char *refname,
20
const char *hash = slash ? slash + 1 : refname;
21
struct replace_object *repl_obj = xmalloc(sizeof(*repl_obj));
22
23
- if (get_oid_hex(hash, &repl_obj->original.oid)) {
23
+ if (get_oid_hex_algop(hash, &repl_obj->original.oid, r->hash_algo)) {
24
free(repl_obj);
25
warning(_("bad replace ref name: %s"), refname);
26
return 0;