)]}'
{
  "commit": "1034ad383f149bf59f4d78f792a049c94240c8a5",
  "tree": "23fa2a9b9e9076d8576d795287da90dbe62b28a3",
  "parents": [
    "e9019fcafe0040228b8631c30f97ae1adb61bcdc"
  ],
  "author": {
    "name": "Adrian Friedli",
    "email": "adrian.friedli@mt.com",
    "time": "Fri Jul 24 14:41:38 2026 +0200"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Fri Jul 24 09:38:06 2026 -0700"
  },
  "message": "builtin/clone: fix segfault when using --revision with protocol v0\n\nServers supporting protocol v2 do not advertise excess refs and honor\n`transport_ls_refs_options.ref_prefixes` when\n\n    $ git clone --revision\u003drefs/heads/main $URL\n\ncontacts them, but when talking to a server that does not support\nprotocol v2 the client segfaults. This can also be observed when v0 is\nenforced for example by\n\n    $ git -c protocol.version\u003d0 clone --revision\u003drefs/heads/main $URL\n\nIn the protocol v2 case the server honors\n`transport_ls_refs_options.ref_prefixes` and in `cmd_clone()` the linked\nlist `refs` returned by `transport_get_remote_refs()` only contains a\nsingle item, which is the ref requested with the --revision argument.\nBoth `remote_head` returned by `find_ref_by_name()` and\n`remote_head_points_at` returned by `guess_remote_head()` are NULL. The\nguard in `update_remote_refs()` skips a the affected code because\n`remote_head_points_at` is NULL.\n\nIn the protocol v0 case in `cmd_clone()` the linked list `refs` returned\nby `transport_get_remote_refs()` contains many items, amongst others\n\"HEAD\". `remote_head` returned by `find_ref_by_name()` is not NULL and\n`remote_head_points_at` returned by `guess_remote_head()` is not NULL\nbut its field `peer_ref` is NULL. Because `remote_head_points_at` is not\nNULL the guard in `update_remote_refs()` does not skip the affected code\nand `remote_head_points_at-\u003epeer_ref-\u003ename` is accessed, which causes a\nsegfault later on.\n\nSigned-off-by: Adrian Friedli \u003cadrian.friedli@mt.com\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "d60d1b60bc238cc9f6dd0a8418ba83107b7e944c",
      "old_mode": 33188,
      "old_path": "builtin/clone.c",
      "new_id": "5cbebbf7c230582f9a1f9ab4993191aadc761303",
      "new_mode": 33188,
      "new_path": "builtin/clone.c"
    },
    {
      "type": "modify",
      "old_id": "db3b8cff558f0bdb1c43a8544966a06cf364e136",
      "old_mode": 33261,
      "old_path": "t/t5621-clone-revision.sh",
      "new_id": "54789423f8cccc921122a313d645e6adcb66cba7",
      "new_mode": 33261,
      "new_path": "t/t5621-clone-revision.sh"
    }
  ]
}
