Skip to content

Commit 0c9aee5

Browse files
bk2204gitster
authored andcommitted
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>
1 parent f6581e2 commit 0c9aee5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

object-file-convert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int repo_oid_to_algop(struct repository *repo, const struct object_id *src,
2323
const struct git_hash_algo *from =
2424
src->algo ? &hash_algos[src->algo] : repo->hash_algo;
2525

26-
if (from == to) {
26+
if (from == to || !to) {
2727
if (src != dest)
2828
oidcpy(dest, src);
2929
return 0;

0 commit comments

Comments
 (0)