From: brian m. carlson Date: Mon, 17 Nov 2025 22:16:08 +0000 (+0000) Subject: conversion: don't crash when no destination algo X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=447480a5a6356b79ab82624390376b13800f140f;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/object-file-convert.c b/object-file-convert.c index 7ab875afe6..e44c821084 100644 --- a/object-file-convert.c +++ b/object-file-convert.c @@ -23,7 +23,7 @@ int repo_oid_to_algop(struct repository *repo, const struct object_id *src, const struct git_hash_algo *from = src->algo ? &hash_algos[src->algo] : repo->hash_algo; - if (from == to) { + if (from == to || !to) { if (src != dest) oidcpy(dest, src); return 0;