@leroysheep / MovieWebApp / commits / 638dc3b063

builtin/clone: fix segfault when using --revision on some servers

Fix a segfault when a server advertises more refs than requested when using the --revision argument. Signed-off-by: Adrian Friedli <adrian.friedli@mt.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Adrian Friedli committed Jul 23, 2026 at 16:43 UTC 638dc3b063aea1dbf6ff03c4785cf9d19e0f49d3
1 file changed +1 -1
builtin/clone.c
+1 -1
index d60d1b60bc..5cbebbf7c2 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -557,7 +557,7 @@ static void update_remote_refs(const struct ref *refs, write_followtags(refs, msg); } - if (remote_head_points_at && !option_bare) { + if (remote_head_points_at && remote_head_points_at->peer_ref && !option_bare) { struct strbuf head_ref = STRBUF_INIT; strbuf_addstr(&head_ref, branch_top); strbuf_addstr(&head_ref, "HEAD");