)]}'
{
  "commit": "1406725b881900074a032e847e2d12a6a059d7e9",
  "tree": "49a1da668a9329f337fa0ec48c851f709a6a0e35",
  "parents": [
    "3a457a08f2cb7d2b3a7279bf2340486eb65c41e0"
  ],
  "author": {
    "name": "Ramsay Jones",
    "email": "ramsay@ramsayjones.plus.com",
    "time": "Sat Oct 27 02:53:57 2018 +0100"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Mon Oct 29 10:14:21 2018 +0900"
  },
  "message": "commit-reach.h: add missing declarations (hdr-check)\n\nAdd the necessary #includes and forward declarations to allow the header\nfile to pass the \u0027hdr-check\u0027 target.\n\nNote that, since this header includes the commit-slab implementation\nheader file (indirectly via commit-slab.h), some of the commit-slab\ninline functions (e.g contains_cache_at_peek()) will not compile without\nthe complete type of \u0027struct commit\u0027. Hence, we replace the forward\ndeclaration of \u0027struct commit\u0027 with the an #include of the \u0027commit.h\u0027\nheader file.\n\nIt is possible, using the \u0027commit-slab-{decl,impl}.h\u0027 files, to avoid\nthis inclusion of the \u0027commit.h\u0027 header. Commit a9f1f1f9f8 (\"commit-slab.h:\ncode split\", 2018-05-19) separated the commit-slab interface from its\nimplementation, to allow for the definition of a public commit-slab data\nstructure. This enabled us to avoid including the commit-slab implementation\nin a header file, which could result in the replication of the commit-slab\nfunctions in each compilation unit in which it was included.\n\nIndeed, if you compile with optimizations disabled, then run this script:\n\n  $ cat -n dup-static.sh\n       1 #!/bin/sh\n       2\n       3 nm $1 | grep \u0027 t \u0027 | cut -d\u0027 \u0027 -f3 | sort | uniq -c |\n       4 \tsort -rn | grep -v \u0027      1\u0027\n  $\n\n  $ ./dup-static.sh git | grep contains\n       24 init_contains_cache_with_stride\n       24 init_contains_cache\n       24 contains_cache_peek\n       24 contains_cache_at_peek\n       24 contains_cache_at\n       24 clear_contains_cache\n  $\n\nyou will find 24 copies of the commit-slab routines for the contains_cache.\nOf course, when you enable optimizations again, these duplicate static\nfunctions (mostly) disappear. Compiling with gcc at -O2, leaves two static\nfunctions, thus:\n\n  $ nm commit-reach.o | grep contains_cache\n  0000000000000870 t contains_cache_at_peek.isra.1.constprop.6\n  $ nm ref-filter.o | grep contains_cache\n  00000000000002b0 t clear_contains_cache.isra.14\n  $\n\nHowever, using a shared \u0027contains_cache\u0027 would result in all six of the\nabove functions as external public functions in the git binary. At present,\nonly three of these functions are actually called, so the trade-off\nseems to favour letting the compiler inline the commit-slab functions.\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": "7d313e2975a28ef79b2ccf6dea965d4f139eda58",
      "old_mode": 33188,
      "old_path": "commit-reach.h",
      "new_id": "f41d8f6ba3b5c2fba5a2eb2d12d10fafd16f4bfd",
      "new_mode": 33188,
      "new_path": "commit-reach.h"
    }
  ]
}
