aboutsummaryrefslogtreecommitdiff
path: root/object-file-convert.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2026-02-07 20:04:32 +0000
committerJunio C Hamano <gitster@pobox.com>2026-02-07 17:41:01 -0800
commit9c317a68b7abc82a9c3c024baa318a29da970c4f (patch)
tree4a295e1da8eba4f7901f9b1e464b670a3a24d250 /object-file-convert.c
parent13ecc938422b204170a3276edb427e0ff38e3670 (diff)
downloadgit-9c317a68b7abc82a9c3c024baa318a29da970c4f.tar.xz
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>
Diffstat (limited to 'object-file-convert.c')
-rw-r--r--object-file-convert.c2
1 files changed, 1 insertions, 1 deletions
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;