)]}'
{
  "commit": "6fe288bfbcbbabc3d399dd71f876dccf71affff0",
  "tree": "674dfbfdeee336e2c5422bc9f99cabb82b4cf1d2",
  "parents": [
    "66c78e0653a4e60c625b8400da31da0ba5bd1286"
  ],
  "author": {
    "name": "Jeff King",
    "email": "peff@peff.net",
    "time": "Sat Nov 15 00:58:18 2025 +0000"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Sat Nov 15 21:18:49 2025 -0800"
  },
  "message": "read-cache: drop submodule check from add_to_cache()\n\nIn add_to_cache(), we treat any directories as submodules, and complain\nif we can\u0027t resolve their HEAD. This call to resolve_gitlink_ref() was\nadded by f937bc2f86 (add: error appropriately on repository with no\ncommits, 2019-04-09), with the goal of improving the error message for\nempty repositories.\n\nBut we already resolve the submodule HEAD in index_path(), which is\nwhere we find the actual oid we\u0027re going to use. Resolving it again here\nintroduces some downsides:\n\n  1. It\u0027s more work, since we have to open up the submodule repository\u0027s\n     files twice.\n\n  2. There are call paths that get to index_path() without going through\n     add_to_cache(). For instance, we\u0027d want a similar informative\n     message if \"git diff empty\" finds that it can\u0027t resolve the\n     submodule\u0027s HEAD. (In theory we can also get there through\n     update-index, but AFAICT it refuses to consider directories as\n     submodules at all, and just complains about them).\n\n  3. The resolution in index_path() catches more errors that we don\u0027t\n     handle here. In particular, it will validate that the object format\n     for the submodule matches that of the superproject. This isn\u0027t a\n     bug, since our call in add_to_cache() throws away the oid it gets\n     without looking at it. But it certainly caused confusion for me\n     when looking at where the object-format check should go.\n\nSo instead of resolving the submodule HEAD in add_to_cache(), let\u0027s just\nteach the call in index_path() to actually produce an error message\n(which it already does for other cases). That\u0027s probably what f937bc2f86\nshould have done in the first place, and it gives us a single point of\nresolution when adding a submodule to the index.\n\nThe resulting output is slightly more verbose, as we propagate the error\nup the call stack, but I think that\u0027s OK (and again, matches many other\nerrors we get when indexing fails).\n\nI\u0027ve left the text of the error message as-is, though it is perhaps\noverly specific.  There are many reasons that resolving the submodule\nHEAD might fail, though outside of corruption or system errors it is\nprobably most likely that the submodule HEAD is simply on an unborn\nbranch.\n\nSigned-off-by: Jeff King \u003cpeff@peff.net\u003e\nSigned-off-by: brian m. carlson \u003csandals@crustytoothpaste.net\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "6ff6cf75499d30f55eabe0924fd6dd8fd9e2c7ab",
      "old_mode": 33188,
      "old_path": "object-file.c",
      "new_id": "bb0c77b45d89a530a8588b0f73cef50cf5a0ccbf",
      "new_mode": 33188,
      "new_path": "object-file.c"
    },
    {
      "type": "modify",
      "old_id": "06ad74db2286aee617b0f7bf5eb3c15cc252a3bf",
      "old_mode": 33188,
      "old_path": "read-cache.c",
      "new_id": "e34c5c56c637fd14543258369fdd6ae64bdad18a",
      "new_mode": 33188,
      "new_path": "read-cache.c"
    },
    {
      "type": "modify",
      "old_id": "9a2c8dbcc23d9164066a05b5ecbbb3ec1ff44044",
      "old_mode": 33261,
      "old_path": "t/t3700-add.sh",
      "new_id": "af93e53c12cfe37a6126ba7376eb0f4c1ad2d816",
      "new_mode": 33261,
      "new_path": "t/t3700-add.sh"
    }
  ]
}
