Merge branch 'af/clone-revision-segfault-fix' into jch

'git clone --revision=' segfaulted when the remote server
advertised more refs than requested (e.g. ignoring ref prefixes),
due to a NULL pointer dereference.  This has been corrected.

* af/clone-revision-segfault-fix:
  builtin/clone: fix segfault when using --revision on some servers
This commit is contained in:
Junio C Hamano
2026-07-23 12:55:04 -07:00

View File

@@ -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");