conversion: don't crash when no destination algo

When we set up a repository that doesn't have a compatibility hash algorithm, we set the destination algorithm object to NULL. In such a case, we want to silently do nothing instead of crashing, so simply treat the operation as a no-op and copy the object ID. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Feb 7, 2026 at 20:04 UTC 9c317a68b7abc82a9c3c024baa318a29da970c4f
1 file changed +1 -1
object-file-convert.c
+1 -1
@@ -23,7 +23,7 @@ int repo_oid_to_algop(struct repository *repo, const struct object_id *src,
23 const struct git_hash_algo *from =
24 src->algo ? &hash_algos[src->algo] : repo->hash_algo;
25
26 - if (from == to) {
26 + if (from == to || !to) {
27 if (src != dest)
28 oidcpy(dest, src);
29 return 0;