Re: [PATCH v5 0/3] Cloning with remote unborn HEAD
From: Junio C Hamano <hidden>
Date: 2021-01-27 06:29:47
Jeff King [off-list ref] writes:
Here's a fix which can be applied on top of jt/clone-unborn-head. It could equally well be applied as part of the merge (with a minor adjustment in the context), but I think it ought to be squashed into Jonathan's patch 1 anyway.
Will queue but we are not merging the topic to 'next' yet, so I'll ask Jonathan to remember making it a part of the series if it needs to be updated later. Thanks.
quoted hunk
-- >8 -- Subject: [PATCH] ls-refs: don't peel NULL oid When the "unborn" feature is enabled, upload-pack serving an ls-refs command will pass a NULL oid into send_ref(). In this case, there is no point trying to peel the ref, since we know it points to nothing. For now this is a harmless waste of cycles (we re-resolve HEAD and find out that indeed, it points to nothing). But after merging with another topic that contains 36a317929b (refs: switch peel_ref() to peel_iterated_oid(), 2021-01-20), we'd actually end up passing NULL to peel_object(), which segfaults! Signed-off-by: Jeff King <redacted> --- ls-refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/ls-refs.c b/ls-refs.c index 4077adeb6a..bc91f03653 100644 --- a/ls-refs.c +++ b/ls-refs.c@@ -66,7 +66,7 @@ static int send_ref(const char *refname, const struct object_id *oid, strip_namespace(symref_target)); } - if (data->peel) { + if (data->peel && oid) { struct object_id peeled; if (!peel_ref(refname, &peeled)) strbuf_addf(&refline, " peeled:%s", oid_to_hex(&peeled));