)]}'
{
  "commit": "00a4b0350198ce2039af2360ff5d83a1f8ee6cd9",
  "tree": "db10d4ac34561c761a81df47e7ea9c42e9bd3386",
  "parents": [
    "156e1782a88d882faf66680b5155a1c140e86a56"
  ],
  "author": {
    "name": "Ramsay Jones",
    "email": "ramsay@ramsayjones.plus.com",
    "time": "Mon Mar 19 17:56:11 2018 +0000"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Tue Mar 20 09:59:21 2018 -0700"
  },
  "message": "read-cache: fix an -Wmaybe-uninitialized warning\n\nThe function ce_write_entry() uses a \u0027self-initialised\u0027 variable\nconstruct, for the symbol \u0027saved_namelen\u0027, to suppress a gcc\n\u0027-Wmaybe-uninitialized\u0027 warning, given that the warning is a false\npositive.\n\nFor the purposes of this discussion, the ce_write_entry() function has\nthree code blocks of interest, that look like so:\n\n        /* block #1 */\n        if (ce-\u003ece_flags \u0026 CE_STRIP_NAME) {\n                saved_namelen \u003d ce_namelen(ce);\n                ce-\u003ece_namelen \u003d 0;\n        }\n\n        /* block #2 */\n        /*\n\t * several code blocks that contain, among others, calls\n         * to copy_cache_entry_to_ondisk(ondisk, ce);\n         */\n\n        /* block #3 */\n        if (ce-\u003ece_flags \u0026 CE_STRIP_NAME) {\n                ce-\u003ece_namelen \u003d saved_namelen;\n                ce-\u003ece_flags \u0026\u003d ~CE_STRIP_NAME;\n        }\n\nThe warning implies that gcc thinks it is possible that the first\nblock is not entered, the calls to copy_cache_entry_to_ondisk()\ncould toggle the CE_STRIP_NAME flag on, thereby entering block #3\nwith saved_namelen unset. However, the copy_cache_entry_to_ondisk()\nfunction does not write to ce-\u003ece_flags (it only reads). gcc could\neasily determine this, since that function is local to this file,\nbut it obviously doesn\u0027t.\n\nIn order to suppress this warning, we make it clear to the reader\n(human and compiler), that block #3 will only be entered when the\nfirst block has been entered, by introducing a new \u0027stripped_name\u0027\nboolean variable. We also take the opportunity to change the type\nof \u0027saved_namelen\u0027 to \u0027unsigned int\u0027 to match ce-\u003ece_namelen.\n\nSigned-off-by: Ramsay Jones \u003cramsay@ramsayjones.plus.com\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2eb81a66b941325dc339d61a0ab804a60cbb8be2",
      "old_mode": 33188,
      "old_path": "read-cache.c",
      "new_id": "49607ddcd7078fb47bac660c39a777a5569d3f80",
      "new_mode": 33188,
      "new_path": "read-cache.c"
    }
  ]
}
