)]}'
{
  "commit": "cf8f6ce02a13f4d1979a53241afbee15a293fce9",
  "tree": "6223e5ea3bcf49d54a407b9372e82d692c28e317",
  "parents": [
    "58325b93c5b6212697b088371809e9948fee8052"
  ],
  "author": {
    "name": "Taylor Blau",
    "email": "me@ttaylorr.com",
    "time": "Tue Jan 24 19:43:48 2023 -0500"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Tue Jan 24 16:52:16 2023 -0800"
  },
  "message": "clone: delay picking a transport until after get_repo_path()\n\nIn the previous commit, t5619 demonstrates an issue where two calls to\n`get_repo_path()` could trick Git into using its local clone mechanism\nin conjunction with a non-local transport.\n\nThat sequence is:\n\n - the starting state is that the local path https:/example.com/foo is a\n   symlink that points to ../../../.git/modules/foo. So it\u0027s dangling.\n\n - get_repo_path() sees that no such path exists (because it\u0027s\n   dangling), and thus we do not canonicalize it into an absolute path\n\n - because we\u0027re using --separate-git-dir, we create .git/modules/foo.\n   Now our symlink is no longer dangling!\n\n - we pass the url to transport_get(), which sees it as an https URL.\n\n - we call get_repo_path() again, on the url. This second call was\n   introduced by f38aa83f9a (use local cloning if insteadOf makes a\n   local URL, 2014-07-17). The idea is that we want to pull the url\n   fresh from the remote.c API, because it will apply any aliases.\n\nAnd of course now it sees that there is a local file, which is a\nmismatch with the transport we already selected.\n\nThe issue in the above sequence is calling `transport_get()` before\ndeciding whether or not the repository is indeed local, and not passing\nin an absolute path if it is local.\n\nThis is reminiscent of a similar bug report in [1], where it was\nsuggested to perform the `insteadOf` lookup earlier. Taking that\napproach may not be as straightforward, since the intent is to store the\noriginal URL in the config, but to actually fetch from the insteadOf\none, so conflating the two early on is a non-starter.\n\nNote: we pass the path returned by `get_repo_path(remote-\u003eurl[0])`,\nwhich should be the same as `repo_name` (aside from any `insteadOf`\nrewrites).\n\nWe *could* pass `absolute_pathdup()` of the same argument, which\n86521acaca (Bring local clone\u0027s origin URL in line with that of a remote\nclone, 2008-09-01) indicates may differ depending on the presence of\n\".git/\" for a non-bare repo. That matters for forming relative submodule\npaths, but doesn\u0027t matter for the second call, since we\u0027re just feeding\nit to the transport code, which is fine either way.\n\n[1]: https://lore.kernel.org/git/CAMoD\u003dBi41mB3QRn3JdZL-FGHs4w3C2jGpnJB-CqSndO7FMtfzA@mail.gmail.com/\n\nSigned-off-by: Jeff King \u003cpeff@peff.net\u003e\nSigned-off-by: Taylor Blau \u003cme@ttaylorr.com\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e626073b1f198cd868ad67221fac3c7c5e01344e",
      "old_mode": 33188,
      "old_path": "builtin/clone.c",
      "new_id": "c042b2e2563f350f63403c8391d7ae377a550577",
      "new_mode": 33188,
      "new_path": "builtin/clone.c"
    },
    {
      "type": "modify",
      "old_id": "7ebd31a15086c56ef62b0eaf021abff5835215c9",
      "old_mode": 33261,
      "old_path": "t/t5619-clone-local-ambiguous-transport.sh",
      "new_id": "cce62bf78d335134903b996c7363c4230ae5ded3",
      "new_mode": 33261,
      "new_path": "t/t5619-clone-local-ambiguous-transport.sh"
    }
  ]
}
