{"thread":{"id":"63271","subject":"[PATCH 0/3] meson: add corresponding target for Makefile's hdr-check","startedAt":"2025-04-08T14:55:33Z","lastAt":"2025-04-23T22:12:30Z","messageCount":69,"participants":["Karthik Nayak","Junio C Hamano","Phillip Wood","Patrick Steinhardt","Toon Claes","Eli Schwartz","phillip.wood123@gmail.com"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"515873","messageId":"20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com","threadId":"63271","inReplyTo":null,"subject":"[PATCH 0/3] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-08T14:55:26Z","receivedAt":"2025-04-08T14:55:33Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"To bridge the remaining gaps between Makefile and meson, this patch series adds\na new check 'headers-check' which is similar to the Makefile's 'hdr-check'.\n\nThe first two commits are small cleanups, where we re-organize existing\nvariables to make it easier to add the target. The third commit adds the target.\n\nThis is based on master 9d22ac5122 (The third batch, 2025-04-07) with\n'es/meson-build-skip-coccinelle' merged in.\n\n---\n contrib/coccinelle/meson.build |  29 +++------\n meson.build                    | 129 +++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 136 insertions(+), 22 deletions(-)\n\nKarthik Nayak (3):\n      coccinelle: meson: rename variables to be more specific\n      meson: move headers definition from 'contrib/coccinelle'\n      meson: add support for 'headers-check'\n---\n\n\n\n---\n\nbase-commit: 3a956c5f69873611ae5f8dcb9acd117f66b95ddc\nchange-id: 20250330-505-wire-up-sparse-via-meson-2e32dd31208b\n\nThanks\n- Karthik\n\n"},{"id":"515874","messageId":"20250408-505-wire-up-sparse-via-meson-v1-1-17476e5cea3f@gmail.com","threadId":"63271","inReplyTo":"20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com","subject":"[PATCH 1/3] coccinelle: meson: rename variables to be more specific","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-08T14:55:27Z","receivedAt":"2025-04-08T14:55:34Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"In meson, included subdirs export their variables to top level meson\nbuilds. In 'contrib/coccinelle/meson.build', we define two such\nvariables `sources` and `headers`. While these variables are specific to\nthe checks in the 'contrib/coccinelle/' directory, they also pollute the\ntop level 'meson.build'.\n\nRename them to be more specific, this ensures that they aren't\nmistakenly used in the upper levels and avoid variable name collisions.\n\nWhile here, change the empty list denotation to be consistent with other\nplaces.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex ea054c924f..03ce52d752 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -55,18 +55,18 @@ concatenated_rules = custom_target(\n   capture: true,\n )\n \n-sources = [ ]\n+coccinelle_sources = []\n foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()\n-  sources += source\n+  coccinelle_sources += source\n endforeach\n \n-headers = [ ]\n+coccinelle_headers = []\n foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n-  headers += meson.project_source_root() / header\n+  coccinelle_headers += meson.project_source_root() / header\n endforeach\n \n patches = [ ]\n-foreach source : sources\n+foreach source : coccinelle_sources\n   patches += custom_target(\n     command: [\n       spatch,\n@@ -78,7 +78,7 @@ foreach source : sources\n     input: meson.project_source_root() / source,\n     output: source.underscorify() + '.patch',\n     capture: true,\n-    depend_files: headers,\n+    depend_files: coccinelle_headers,\n   )\n endforeach\n \n\n-- \n2.48.1\n\n"},{"id":"515875","messageId":"20250408-505-wire-up-sparse-via-meson-v1-2-17476e5cea3f@gmail.com","threadId":"63271","inReplyTo":"20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com","subject":"[PATCH 2/3] meson: move headers definition from 'contrib/coccinelle'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-08T14:55:28Z","receivedAt":"2025-04-08T14:55:34Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The meson build for coccinelle static analysis lists all headers to\nanalyse. Due to the way meson exports variables between subdirs, this\nvariable is also available in the root meson build.\n\nAn upcoming commit, will add a new check complimenting 'hdr-check' in\nthe Makefile. This would require the list of headers. So move the\n'coccinelle_headers' to the root meson build and rename it to 'headers',\nremove the root path being appended to each header and retain that in\nthe coccinelle meson build since it is specific to the coccinelle build.\n\nAlso move the 'third_party_sources' variable to the root meson build\nsince it is also a dependency for the 'headers' variable. This also\nmakes it easier to understand as the variable is now propagated from the\ntop level to the bottom.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 17 +----------------\n meson.build                    | 22 ++++++++++++++++++++++\n 2 files changed, 23 insertions(+), 16 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex 03ce52d752..32568c5103 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -8,21 +8,6 @@ if not spatch.found()\n   subdir_done()\n endif\n \n-third_party_sources = [\n-  ':!contrib',\n-  ':!compat/inet_ntop.c',\n-  ':!compat/inet_pton.c',\n-  ':!compat/nedmalloc',\n-  ':!compat/obstack.*',\n-  ':!compat/poll',\n-  ':!compat/regex',\n-  ':!sha1collisiondetection',\n-  ':!sha1dc',\n-  ':!t/unit-tests/clar',\n-  ':!t/unit-tests/clar',\n-  ':!t/t[0-9][0-9][0-9][0-9]*',\n-]\n-\n rules = [\n   'array.cocci',\n   'commit.cocci',\n@@ -61,7 +46,7 @@ foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files',\n endforeach\n \n coccinelle_headers = []\n-foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+foreach header : headers\n   coccinelle_headers += meson.project_source_root() / header\n endforeach\n \ndiff --git a/meson.build b/meson.build\nindex e98cfa4909..790d178007 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -633,6 +633,28 @@ builtin_sources = [\n   'builtin/write-tree.c',\n ]\n \n+third_party_sources = [\n+  ':!contrib',\n+  ':!compat/inet_ntop.c',\n+  ':!compat/inet_pton.c',\n+  ':!compat/nedmalloc',\n+  ':!compat/obstack.*',\n+  ':!compat/poll',\n+  ':!compat/regex',\n+  ':!sha1collisiondetection',\n+  ':!sha1dc',\n+  ':!t/unit-tests/clar',\n+  ':!t/unit-tests/clar',\n+  ':!t/t[0-9][0-9][0-9][0-9]*',\n+]\n+\n+headers = []\n+if git.found()\n+  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+    headers += header\n+  endforeach\n+endif\n+\n if not get_option('breaking_changes')\n   builtin_sources += 'builtin/pack-redundant.c'\n endif\n\n-- \n2.48.1\n\n"},{"id":"515876","messageId":"20250408-505-wire-up-sparse-via-meson-v1-3-17476e5cea3f@gmail.com","threadId":"63271","inReplyTo":"20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com","subject":"[PATCH 3/3] meson: add support for 'headers-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-08T14:55:29Z","receivedAt":"2025-04-08T14:55:35Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The Makefile supports a target called 'hdr-check', which checks if\nindividual header files can be independently compiled. Let's port this\nfunctionality to meson, our new build system too.\n\nLet's avoid the abbreviation and name the target 'headers-check', which\nis easier to read.\n\nThe implementation resembles that of the Makefile and provides the same\ncheck.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 107 insertions(+)\n\ndiff --git a/meson.build b/meson.build\nindex 790d178007..1e0ecd37d3 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -655,6 +655,12 @@ if git.found()\n   endforeach\n endif\n \n+headers_generated = [\n+  'command-list.h',\n+  'config-list.h',\n+  'hook-list.h'\n+]\n+\n if not get_option('breaking_changes')\n   builtin_sources += 'builtin/pack-redundant.c'\n endif\n@@ -1995,6 +2001,107 @@ endif\n \n subdir('contrib')\n \n+headers_check_exclude = headers_generated\n+headers_check_exclude += [\n+  'compat/apple-common-crypto.h',\n+  'compat/bswap.h',\n+  'compat/compiler.h',\n+  'compat/disk.h',\n+  'compat/fsmonitor/fsm-darwin-gcc.h',\n+  'compat/fsmonitor/fsm-health.h',\n+  'compat/fsmonitor/fsm-listen.h',\n+  'compat/mingw.h',\n+  'compat/msvc.h',\n+  'compat/nedmalloc/malloc.c.h',\n+  'compat/nedmalloc/nedmalloc.h',\n+  'compat/nonblock.h',\n+  'compat/obstack.h',\n+  'compat/poll/poll.h',\n+  'compat/precompose_utf8.h',\n+  'compat/regex/regex.h',\n+  'compat/regex/regex_internal.h',\n+  'compat/sha1-chunked.h',\n+  'compat/terminal.h',\n+  'compat/vcbuild/include/sys/param.h',\n+  'compat/vcbuild/include/sys/time.h',\n+  'compat/vcbuild/include/sys/utime.h',\n+  'compat/vcbuild/include/unistd.h',\n+  'compat/vcbuild/include/utime.h',\n+  'compat/win32.h',\n+  'compat/win32/alloca.h',\n+  'compat/win32/dirent.h',\n+  'compat/win32/lazyload.h',\n+  'compat/win32/path-utils.h',\n+  'compat/win32/pthread.h',\n+  'compat/win32/syslog.h',\n+  'compat/zlib-compat.h',\n+  't/unit-tests/clar/clar.h',\n+  't/unit-tests/clar/clar/fixtures.h',\n+  't/unit-tests/clar/clar/fs.h',\n+  't/unit-tests/clar/clar/print.h',\n+  't/unit-tests/clar/clar/sandbox.h',\n+  't/unit-tests/clar/clar/summary.h',\n+  't/unit-tests/clar/test/clar_test.h',\n+  'unicode-width.h',\n+  'xdiff/xdiff.h',\n+  'xdiff/xdiffi.h',\n+  'xdiff/xemit.h',\n+  'xdiff/xinclude.h',\n+  'xdiff/xmacros.h',\n+  'xdiff/xprepare.h',\n+  'xdiff/xtypes.h',\n+  'xdiff/xutils.h',\n+]\n+\n+if sha1_backend != 'openssl'\n+  headers_check_exclude += 'sha1/openssl.h'\n+endif\n+if sha256_backend != 'openssl'\n+  headers_check_exclude += 'sha256/openssl.h'\n+endif\n+if sha256_backend != 'nettle'\n+  headers_check_exclude += 'sha256/nettle.h'\n+endif\n+if sha256_backend != 'gcrpyt'\n+  headers_check_exclude += 'sha256/gcrypt.h'\n+endif\n+\n+if headers.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n+  hco_targets = []\n+  foreach h : headers\n+    if headers_check_exclude.contains(h)\n+      continue\n+    endif\n+\n+    hcc = custom_target(\n+      input: h,\n+      output: h.underscorify() + 'cc',\n+      command: [\n+        shell,\n+        '-c',\n+        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo -n \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n+      ]\n+    )\n+\n+    hco = custom_target(\n+      input: hcc,\n+      output: h.underscorify().replace('.h', '.hco'),\n+      command: [\n+        compiler.cmd_array(),\n+        libgit_c_args,\n+        '-I', meson.project_source_root(),\n+        '-I', meson.project_source_root() / 't/unit-tests',\n+        '-o', '/dev/null',\n+        '-c', '-xc',\n+        '@INPUT@'\n+      ]\n+    )\n+    hco_targets += hco\n+  endforeach\n+\n+  alias_target('headers-check', hco_targets)\n+endif\n+\n foreach key, value : {\n   'DIFF': diff.full_path(),\n   'GIT_SOURCE_DIR': meson.project_source_root(),\n\n-- \n2.48.1\n\n"},{"id":"515900","messageId":"xmqqsemiuwhx.fsf@gitster.g","threadId":"63271","inReplyTo":"20250408-505-wire-up-sparse-via-meson-v1-3-17476e5cea3f@gmail.com","subject":"Re: [PATCH 3/3] meson: add support for 'headers-check'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-08T22:19:38Z","receivedAt":"2025-04-08T22:19:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> The Makefile supports a target called 'hdr-check', which checks if\n> individual header files can be independently compiled. Let's port this\n> functionality to meson, our new build system too.\n\nGood goal.\n\n> Let's avoid the abbreviation and name the target 'headers-check', which\n> is easier to read.\n\nThis is a bit dubious.  Are developers supposed to keep track of\ncorrespondence between the long establish name and the new name this\npatch just came up with?  For how long?\n\nIf we make it one of our goals to name the build target in\npronounceable ways, that is perfectly fine, and it would be a good\ntask to allow \"make headers-check\" be a synonym for \"make hdr-check\"\n(and do the same on the meson side), and deprecate hdr-check in a\ncycle or two (this is not end-user facing, so the transition period\ncan legitimately be much shorter than usual.\n\nBut we still need to have some transition period to help those who\nbuild from the source adjust their set-ups that have called \"make\nhdr-check\" for a long time.\n\n"},{"id":"515945","messageId":"CAOLa=ZTRAQJjYU2cvxOw=tmCkQH7CLm027B5ZkGSg10qdGQENg@mail.gmail.com","threadId":"63271","inReplyTo":"xmqqsemiuwhx.fsf@gitster.g","subject":"Re: [PATCH 3/3] meson: add support for 'headers-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-10T09:13:22Z","receivedAt":"2025-04-10T09:13:24Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Karthik Nayak <karthik.188@gmail.com> writes:\n>\n>> The Makefile supports a target called 'hdr-check', which checks if\n>> individual header files can be independently compiled. Let's port this\n>> functionality to meson, our new build system too.\n>\n> Good goal.\n>\n>> Let's avoid the abbreviation and name the target 'headers-check', which\n>> is easier to read.\n>\n> This is a bit dubious.  Are developers supposed to keep track of\n> correspondence between the long establish name and the new name this\n> patch just came up with?  For how long?\n>\n\nFair enough.\n\n> If we make it one of our goals to name the build target in\n> pronounceable ways, that is perfectly fine, and it would be a good\n> task to allow \"make headers-check\" be a synonym for \"make hdr-check\"\n> (and do the same on the meson side), and deprecate hdr-check in a\n> cycle or two (this is not end-user facing, so the transition period\n> can legitimately be much shorter than usual.\n>\n> But we still need to have some transition period to help those who\n> build from the source adjust their set-ups that have called \"make\n> hdr-check\" for a long time.\n\nWell put. My intention was that anyone using meson will anyways have to\nchange from `make <target>` to `meson compile <target>`. So they\nwouldn't mind <target> changing too.\n\nBut it would be nicer to keep both the old target and the new\nreplacement and eventually remove the old target. Will do that and send\nin a new version.\n"},{"id":"515948","messageId":"20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com","threadId":"63271","inReplyTo":"20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com","subject":"[PATCH v2 0/4] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-10T11:30:30Z","receivedAt":"2025-04-10T11:30:45Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"To bridge the remaining gaps between Makefile and meson, this patch series adds\n'hdr-check' to meson to compliment the Makefile's 'hdr-check'.\n\nWe also introduce 'headers-check' as an alias to 'hdr-check' as a better named \nreplacement in both meson and make and add a note to deprecate 'hdr-check' in\nthe future.\n\nThe first two commits are small cleanups, where we re-organize existing\nvariables to make it easier to add the target. The third commit adds the\n'hdr-check' target to meson. The last commit introduces the 'headers-check'\nalias to both meson and the makefile and marks 'hdr-check' to be deprecated.\n\nThis is based on master 9d22ac5122 (The third batch, 2025-04-07) with\n'es/meson-build-skip-coccinelle' merged in.\n\n---\nChanges in v2:\n- Add 'hdr-check' to meson, while introducing 'headers-check' as \n  a replacement alias. Schedule 'hdr-check' to be deprecated in the future.\n- Link to v1: https://lore.kernel.org/r/20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com\n\n---\n Makefile                       |   4 +-\n ci/run-static-analysis.sh      |   2 +-\n contrib/coccinelle/meson.build |  29 +++------\n meson.build                    | 131 +++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 142 insertions(+), 24 deletions(-)\n\nKarthik Nayak (4):\n      coccinelle: meson: rename variables to be more specific\n      meson: move headers definition from 'contrib/coccinelle'\n      meson: add support for 'hdr-check'\n      makefile/meson: add 'headers-check' as alias for 'hdr-check'\n\nRange-diff versus v1:\n\n1:  aed80c7868 = 1:  c6493671b5 coccinelle: meson: rename variables to be more specific\n2:  cf2a8c50c2 = 2:  33e9b21bae meson: move headers definition from 'contrib/coccinelle'\n3:  938aac6573 ! 3:  b6be631165 meson: add support for 'headers-check'\n    @@ Metadata\n     Author: Karthik Nayak <karthik.188@gmail.com>\n     \n      ## Commit message ##\n    -    meson: add support for 'headers-check'\n    +    meson: add support for 'hdr-check'\n     \n         The Makefile supports a target called 'hdr-check', which checks if\n         individual header files can be independently compiled. Let's port this\n    -    functionality to meson, our new build system too.\n    -\n    -    Let's avoid the abbreviation and name the target 'headers-check', which\n    -    is easier to read.\n    -\n    -    The implementation resembles that of the Makefile and provides the same\n    -    check.\n    +    functionality to meson, our new build system too. The implementation\n    +    resembles that of the Makefile and provides the same check.\n     \n         Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n     \n    @@ meson.build: endif\n     +    hco_targets += hco\n     +  endforeach\n     +\n    -+  alias_target('headers-check', hco_targets)\n    ++  alias_target('hdr-check', hco_targets)\n     +endif\n     +\n      foreach key, value : {\n-:  ---------- > 4:  d265cd97df makefile/meson: add 'headers-check' as alias for 'hdr-check'\n\n\nbase-commit: 3a956c5f69873611ae5f8dcb9acd117f66b95ddc\nchange-id: 20250330-505-wire-up-sparse-via-meson-2e32dd31208b\n\nThanks\n- Karthik\n\n"},{"id":"515949","messageId":"20250410-505-wire-up-sparse-via-meson-v2-1-acb45cc8a2e5@gmail.com","threadId":"63271","inReplyTo":"20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com","subject":"[PATCH v2 1/4] coccinelle: meson: rename variables to be more specific","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-10T11:30:31Z","receivedAt":"2025-04-10T11:30:46Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"In meson, included subdirs export their variables to top level meson\nbuilds. In 'contrib/coccinelle/meson.build', we define two such\nvariables `sources` and `headers`. While these variables are specific to\nthe checks in the 'contrib/coccinelle/' directory, they also pollute the\ntop level 'meson.build'.\n\nRename them to be more specific, this ensures that they aren't\nmistakenly used in the upper levels and avoid variable name collisions.\n\nWhile here, change the empty list denotation to be consistent with other\nplaces.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex ea054c924f..03ce52d752 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -55,18 +55,18 @@ concatenated_rules = custom_target(\n   capture: true,\n )\n \n-sources = [ ]\n+coccinelle_sources = []\n foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()\n-  sources += source\n+  coccinelle_sources += source\n endforeach\n \n-headers = [ ]\n+coccinelle_headers = []\n foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n-  headers += meson.project_source_root() / header\n+  coccinelle_headers += meson.project_source_root() / header\n endforeach\n \n patches = [ ]\n-foreach source : sources\n+foreach source : coccinelle_sources\n   patches += custom_target(\n     command: [\n       spatch,\n@@ -78,7 +78,7 @@ foreach source : sources\n     input: meson.project_source_root() / source,\n     output: source.underscorify() + '.patch',\n     capture: true,\n-    depend_files: headers,\n+    depend_files: coccinelle_headers,\n   )\n endforeach\n \n\n-- \n2.48.1\n\n"},{"id":"515950","messageId":"20250410-505-wire-up-sparse-via-meson-v2-2-acb45cc8a2e5@gmail.com","threadId":"63271","inReplyTo":"20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com","subject":"[PATCH v2 2/4] meson: move headers definition from 'contrib/coccinelle'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-10T11:30:32Z","receivedAt":"2025-04-10T11:30:47Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The meson build for coccinelle static analysis lists all headers to\nanalyse. Due to the way meson exports variables between subdirs, this\nvariable is also available in the root meson build.\n\nAn upcoming commit, will add a new check complimenting 'hdr-check' in\nthe Makefile. This would require the list of headers. So move the\n'coccinelle_headers' to the root meson build and rename it to 'headers',\nremove the root path being appended to each header and retain that in\nthe coccinelle meson build since it is specific to the coccinelle build.\n\nAlso move the 'third_party_sources' variable to the root meson build\nsince it is also a dependency for the 'headers' variable. This also\nmakes it easier to understand as the variable is now propagated from the\ntop level to the bottom.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 17 +----------------\n meson.build                    | 22 ++++++++++++++++++++++\n 2 files changed, 23 insertions(+), 16 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex 03ce52d752..32568c5103 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -8,21 +8,6 @@ if not spatch.found()\n   subdir_done()\n endif\n \n-third_party_sources = [\n-  ':!contrib',\n-  ':!compat/inet_ntop.c',\n-  ':!compat/inet_pton.c',\n-  ':!compat/nedmalloc',\n-  ':!compat/obstack.*',\n-  ':!compat/poll',\n-  ':!compat/regex',\n-  ':!sha1collisiondetection',\n-  ':!sha1dc',\n-  ':!t/unit-tests/clar',\n-  ':!t/unit-tests/clar',\n-  ':!t/t[0-9][0-9][0-9][0-9]*',\n-]\n-\n rules = [\n   'array.cocci',\n   'commit.cocci',\n@@ -61,7 +46,7 @@ foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files',\n endforeach\n \n coccinelle_headers = []\n-foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+foreach header : headers\n   coccinelle_headers += meson.project_source_root() / header\n endforeach\n \ndiff --git a/meson.build b/meson.build\nindex e98cfa4909..790d178007 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -633,6 +633,28 @@ builtin_sources = [\n   'builtin/write-tree.c',\n ]\n \n+third_party_sources = [\n+  ':!contrib',\n+  ':!compat/inet_ntop.c',\n+  ':!compat/inet_pton.c',\n+  ':!compat/nedmalloc',\n+  ':!compat/obstack.*',\n+  ':!compat/poll',\n+  ':!compat/regex',\n+  ':!sha1collisiondetection',\n+  ':!sha1dc',\n+  ':!t/unit-tests/clar',\n+  ':!t/unit-tests/clar',\n+  ':!t/t[0-9][0-9][0-9][0-9]*',\n+]\n+\n+headers = []\n+if git.found()\n+  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+    headers += header\n+  endforeach\n+endif\n+\n if not get_option('breaking_changes')\n   builtin_sources += 'builtin/pack-redundant.c'\n endif\n\n-- \n2.48.1\n\n"},{"id":"515951","messageId":"20250410-505-wire-up-sparse-via-meson-v2-3-acb45cc8a2e5@gmail.com","threadId":"63271","inReplyTo":"20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com","subject":"[PATCH v2 3/4] meson: add support for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-10T11:30:33Z","receivedAt":"2025-04-10T11:30:48Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The Makefile supports a target called 'hdr-check', which checks if\nindividual header files can be independently compiled. Let's port this\nfunctionality to meson, our new build system too. The implementation\nresembles that of the Makefile and provides the same check.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 107 insertions(+)\n\ndiff --git a/meson.build b/meson.build\nindex 790d178007..6fce1aa618 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -655,6 +655,12 @@ if git.found()\n   endforeach\n endif\n \n+headers_generated = [\n+  'command-list.h',\n+  'config-list.h',\n+  'hook-list.h'\n+]\n+\n if not get_option('breaking_changes')\n   builtin_sources += 'builtin/pack-redundant.c'\n endif\n@@ -1995,6 +2001,107 @@ endif\n \n subdir('contrib')\n \n+headers_check_exclude = headers_generated\n+headers_check_exclude += [\n+  'compat/apple-common-crypto.h',\n+  'compat/bswap.h',\n+  'compat/compiler.h',\n+  'compat/disk.h',\n+  'compat/fsmonitor/fsm-darwin-gcc.h',\n+  'compat/fsmonitor/fsm-health.h',\n+  'compat/fsmonitor/fsm-listen.h',\n+  'compat/mingw.h',\n+  'compat/msvc.h',\n+  'compat/nedmalloc/malloc.c.h',\n+  'compat/nedmalloc/nedmalloc.h',\n+  'compat/nonblock.h',\n+  'compat/obstack.h',\n+  'compat/poll/poll.h',\n+  'compat/precompose_utf8.h',\n+  'compat/regex/regex.h',\n+  'compat/regex/regex_internal.h',\n+  'compat/sha1-chunked.h',\n+  'compat/terminal.h',\n+  'compat/vcbuild/include/sys/param.h',\n+  'compat/vcbuild/include/sys/time.h',\n+  'compat/vcbuild/include/sys/utime.h',\n+  'compat/vcbuild/include/unistd.h',\n+  'compat/vcbuild/include/utime.h',\n+  'compat/win32.h',\n+  'compat/win32/alloca.h',\n+  'compat/win32/dirent.h',\n+  'compat/win32/lazyload.h',\n+  'compat/win32/path-utils.h',\n+  'compat/win32/pthread.h',\n+  'compat/win32/syslog.h',\n+  'compat/zlib-compat.h',\n+  't/unit-tests/clar/clar.h',\n+  't/unit-tests/clar/clar/fixtures.h',\n+  't/unit-tests/clar/clar/fs.h',\n+  't/unit-tests/clar/clar/print.h',\n+  't/unit-tests/clar/clar/sandbox.h',\n+  't/unit-tests/clar/clar/summary.h',\n+  't/unit-tests/clar/test/clar_test.h',\n+  'unicode-width.h',\n+  'xdiff/xdiff.h',\n+  'xdiff/xdiffi.h',\n+  'xdiff/xemit.h',\n+  'xdiff/xinclude.h',\n+  'xdiff/xmacros.h',\n+  'xdiff/xprepare.h',\n+  'xdiff/xtypes.h',\n+  'xdiff/xutils.h',\n+]\n+\n+if sha1_backend != 'openssl'\n+  headers_check_exclude += 'sha1/openssl.h'\n+endif\n+if sha256_backend != 'openssl'\n+  headers_check_exclude += 'sha256/openssl.h'\n+endif\n+if sha256_backend != 'nettle'\n+  headers_check_exclude += 'sha256/nettle.h'\n+endif\n+if sha256_backend != 'gcrpyt'\n+  headers_check_exclude += 'sha256/gcrypt.h'\n+endif\n+\n+if headers.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n+  hco_targets = []\n+  foreach h : headers\n+    if headers_check_exclude.contains(h)\n+      continue\n+    endif\n+\n+    hcc = custom_target(\n+      input: h,\n+      output: h.underscorify() + 'cc',\n+      command: [\n+        shell,\n+        '-c',\n+        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo -n \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n+      ]\n+    )\n+\n+    hco = custom_target(\n+      input: hcc,\n+      output: h.underscorify().replace('.h', '.hco'),\n+      command: [\n+        compiler.cmd_array(),\n+        libgit_c_args,\n+        '-I', meson.project_source_root(),\n+        '-I', meson.project_source_root() / 't/unit-tests',\n+        '-o', '/dev/null',\n+        '-c', '-xc',\n+        '@INPUT@'\n+      ]\n+    )\n+    hco_targets += hco\n+  endforeach\n+\n+  alias_target('hdr-check', hco_targets)\n+endif\n+\n foreach key, value : {\n   'DIFF': diff.full_path(),\n   'GIT_SOURCE_DIR': meson.project_source_root(),\n\n-- \n2.48.1\n\n"},{"id":"515952","messageId":"20250410-505-wire-up-sparse-via-meson-v2-4-acb45cc8a2e5@gmail.com","threadId":"63271","inReplyTo":"20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com","subject":"[PATCH v2 4/4] makefile/meson: add 'headers-check' as alias for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-10T11:30:34Z","receivedAt":"2025-04-10T11:30:49Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 'hdr-check' target in meson and makefile is used to check if headers\ncan be compiled individually. The naming however isn't readable as 'hdr'\nis not a common shortforme for 'header', neither is it an abbreviation.\n\nLet's introduce 'headers-check' as an alternative target for 'hdr-check'\nand add a `TODO` to deprecate the latter after 2 releases. Since this\nis an internal tool, we can use a shorter deprecation cycle.\n\nChange existing usage of 'hdr-check' in 'ci/run-static-analysis.sh' to\nalso use 'headers-check'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n Makefile                  | 4 +++-\n ci/run-static-analysis.sh | 2 +-\n meson.build               | 2 ++\n 3 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex ac32d2d0bd..0ac91e0af1 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3326,8 +3326,10 @@ HCC = $(HCO:hco=hcc)\n $(HCO): %.hco: %.hcc $(GENERATED_H) FORCE\n \t$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<\n \n-.PHONY: hdr-check $(HCO)\n+# TODO: deprecate 'hdr-check' in lieu of 'headers-check' in Git 2.51+\n+.PHONY: hdr-check headers-check $(HCO)\n hdr-check: $(HCO)\n+headers-check: hdr-check\n \n .PHONY: style\n style:\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 0d51e5ce0e..2e51411d6e 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -26,7 +26,7 @@ then\n \texit 1\n fi\n \n-make hdr-check ||\n+make headers-check ||\n exit 1\n \n make check-pot\ndiff --git a/meson.build b/meson.build\nindex 6fce1aa618..74597283b9 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -2099,7 +2099,9 @@ if headers.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n     hco_targets += hco\n   endforeach\n \n+  # TODO: deprecate 'hdr-check' in lieu of 'headers-check' in Git 2.51+\n   alias_target('hdr-check', hco_targets)\n+  alias_target('headers-check', hco_targets)\n endif\n \n foreach key, value : {\n\n-- \n2.48.1\n\n"},{"id":"515961","messageId":"dc0d6acb-bcf1-4a7e-bfc8-7c2e7793c72b@gmail.com","threadId":"63271","inReplyTo":"20250410-505-wire-up-sparse-via-meson-v2-3-acb45cc8a2e5@gmail.com","subject":"Re: [PATCH v2 3/4] meson: add support for 'hdr-check'","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-10T14:50:39Z","receivedAt":"2025-04-10T14:50:53Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Karthik\n\nOn 10/04/2025 12:30, Karthik Nayak wrote:\n> The Makefile supports a target called 'hdr-check', which checks if\n> individual header files can be independently compiled. Let's port this\n> functionality to meson, our new build system too. The implementation\n> resembles that of the Makefile and provides the same check.\n\nThanks for adding this, I've left a few comments below\n\n> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n> ---\n>   meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>   1 file changed, 107 insertions(+)\n> \n> diff --git a/meson.build b/meson.build\n> index 790d178007..6fce1aa618 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -655,6 +655,12 @@ if git.found()\n>     endforeach\n>   endif\n>   \n> +headers_generated = [\n\nTo me \"generated_headers\" would be a more natural name and would match \nthe style of \"coccinelle_headers\" from patch 1 as well as the equivalent \nin the Makefile.\n\n> +  'command-list.h',\n> +  'config-list.h',\n> +  'hook-list.h'\n> +]\n> +\n>   if not get_option('breaking_changes')\n>     builtin_sources += 'builtin/pack-redundant.c'\n>   endif\n> @@ -1995,6 +2001,107 @@ endif\n>   \n>   subdir('contrib')\n>   \n> +headers_check_exclude = headers_generated\n> +headers_check_exclude += [\n> +  'compat/apple-common-crypto.h',\n> +  'compat/bswap.h',\n> +  'compat/compiler.h',\n> +  'compat/disk.h',\n> +  'compat/fsmonitor/fsm-darwin-gcc.h',\n> +  'compat/fsmonitor/fsm-health.h',\n> +  'compat/fsmonitor/fsm-listen.h',\n> +  'compat/mingw.h',\n> +  'compat/msvc.h',\n> +  'compat/nedmalloc/malloc.c.h',\n> +  'compat/nedmalloc/nedmalloc.h',\n> +  'compat/nonblock.h',\n> +  'compat/obstack.h',\n> +  'compat/poll/poll.h',\n> +  'compat/precompose_utf8.h',\n> +  'compat/regex/regex.h',\n> +  'compat/regex/regex_internal.h',\n> +  'compat/sha1-chunked.h',\n> +  'compat/terminal.h',\n> +  'compat/vcbuild/include/sys/param.h',\n> +  'compat/vcbuild/include/sys/time.h',\n> +  'compat/vcbuild/include/sys/utime.h',\n> +  'compat/vcbuild/include/unistd.h',\n> +  'compat/vcbuild/include/utime.h',\n> +  'compat/win32.h',\n> +  'compat/win32/alloca.h',\n> +  'compat/win32/dirent.h',\n> +  'compat/win32/lazyload.h',\n> +  'compat/win32/path-utils.h',\n> +  'compat/win32/pthread.h',\n> +  'compat/win32/syslog.h',\n> +  'compat/zlib-compat.h',\n> +  't/unit-tests/clar/clar.h',\n> +  't/unit-tests/clar/clar/fixtures.h',\n> +  't/unit-tests/clar/clar/fs.h',\n> +  't/unit-tests/clar/clar/print.h',\n> +  't/unit-tests/clar/clar/sandbox.h',\n> +  't/unit-tests/clar/clar/summary.h',\n> +  't/unit-tests/clar/test/clar_test.h',\n> +  'unicode-width.h',\n> +  'xdiff/xdiff.h',\n> +  'xdiff/xdiffi.h',\n> +  'xdiff/xemit.h',\n> +  'xdiff/xinclude.h',\n> +  'xdiff/xmacros.h',\n> +  'xdiff/xprepare.h',\n> +  'xdiff/xtypes.h',\n> +  'xdiff/xutils.h',\n> +]\n\nHaving to manually maintain this list is a bit of a shame as every time \na new file is added to compat we need to add it to meson.build twice. \nThe Makefile avoids this by filtering the list of headers used when \nbuilding git based on their path - can we do the same here?\n\n> +if sha1_backend != 'openssl'\n> +  headers_check_exclude += 'sha1/openssl.h'\n> +endif\n> +if sha256_backend != 'openssl'\n> +  headers_check_exclude += 'sha256/openssl.h'\n> +endif\n> +if sha256_backend != 'nettle'\n> +  headers_check_exclude += 'sha256/nettle.h'\n> +endif\n> +if sha256_backend != 'gcrpyt'\n> +  headers_check_exclude += 'sha256/gcrypt.h'\n> +endif\n> +\n> +if headers.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n> +  hco_targets = []\n> +  foreach h : headers\n> +    if headers_check_exclude.contains(h)\n> +      continue\n> +    endif\n> +\n> +    hcc = custom_target(\n> +      input: h,\n> +      output: h.underscorify() + 'cc',\n> +      command: [\n> +        shell,\n> +        '-c',\n> +        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo -n \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n\nThis line is rather long. Also do we really need \"echo -n\" here, the \nMakefile does not use it.\n\n> +      ]\n> +    )\n> +\n> +    hco = custom_target(\n> +      input: hcc,\n> +      output: h.underscorify().replace('.h', '.hco'),\n> +      command: [\n> +        compiler.cmd_array(),\n> +        libgit_c_args,\n> +        '-I', meson.project_source_root(),\n> +        '-I', meson.project_source_root() / 't/unit-tests',\n\nDo you know why we don't need to add these include paths for the \nequivalent rule in the Makefile?\n\nThanks\n\nPhillip\n\n> +        '-o', '/dev/null',\n> +        '-c', '-xc',\n> +        '@INPUT@'\n> +      ]\n> +    )\n> +    hco_targets += hco\n> +  endforeach\n> +\n> +  alias_target('hdr-check', hco_targets)\n> +endif\n> +\n>   foreach key, value : {\n>     'DIFF': diff.full_path(),\n>     'GIT_SOURCE_DIR': meson.project_source_root(),\n> \n\n"},{"id":"515962","messageId":"7eaa33ca-0ccc-4789-94b5-de1a068e1599@gmail.com","threadId":"63271","inReplyTo":"20250410-505-wire-up-sparse-via-meson-v2-4-acb45cc8a2e5@gmail.com","subject":"Re: [PATCH v2 4/4] makefile/meson: add 'headers-check' as alias for 'hdr-check'","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-10T14:50:45Z","receivedAt":"2025-04-10T14:50:58Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Karthik\n\nOn 10/04/2025 12:30, Karthik Nayak wrote:\n> The 'hdr-check' target in meson and makefile is used to check if headers\n> can be compiled individually. The naming however isn't readable as 'hdr'\n> is not a common shortforme for 'header', neither is it an abbreviation.\n> \n> Let's introduce 'headers-check' as an alternative target for 'hdr-check'\n> and add a `TODO` to deprecate the latter after 2 releases. Since this\n> is an internal tool, we can use a shorter deprecation cycle.\n\nCan we call this \"check-headers\" to match the other \"check-\" targets in \nthe Makefile please\n\nThanks\n\nPhillip\n\n> Change existing usage of 'hdr-check' in 'ci/run-static-analysis.sh' to\n> also use 'headers-check'.\n> \n> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n> ---\n>   Makefile                  | 4 +++-\n>   ci/run-static-analysis.sh | 2 +-\n>   meson.build               | 2 ++\n>   3 files changed, 6 insertions(+), 2 deletions(-)\n> \n> diff --git a/Makefile b/Makefile\n> index ac32d2d0bd..0ac91e0af1 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -3326,8 +3326,10 @@ HCC = $(HCO:hco=hcc)\n>   $(HCO): %.hco: %.hcc $(GENERATED_H) FORCE\n>   \t$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<\n>   \n> -.PHONY: hdr-check $(HCO)\n> +# TODO: deprecate 'hdr-check' in lieu of 'headers-check' in Git 2.51+\n> +.PHONY: hdr-check headers-check $(HCO)\n>   hdr-check: $(HCO)\n> +headers-check: hdr-check\n>   \n>   .PHONY: style\n>   style:\n> diff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\n> index 0d51e5ce0e..2e51411d6e 100755\n> --- a/ci/run-static-analysis.sh\n> +++ b/ci/run-static-analysis.sh\n> @@ -26,7 +26,7 @@ then\n>   \texit 1\n>   fi\n>   \n> -make hdr-check ||\n> +make headers-check ||\n>   exit 1\n>   \n>   make check-pot\n> diff --git a/meson.build b/meson.build\n> index 6fce1aa618..74597283b9 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -2099,7 +2099,9 @@ if headers.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n>       hco_targets += hco\n>     endforeach\n>   \n> +  # TODO: deprecate 'hdr-check' in lieu of 'headers-check' in Git 2.51+\n>     alias_target('hdr-check', hco_targets)\n> +  alias_target('headers-check', hco_targets)\n>   endif\n>   \n>   foreach key, value : {\n> \n\n"},{"id":"515965","messageId":"xmqqtt6voncw.fsf@gitster.g","threadId":"63271","inReplyTo":"7eaa33ca-0ccc-4789-94b5-de1a068e1599@gmail.com","subject":"Re: [PATCH v2 4/4] makefile/meson: add 'headers-check' as alias for 'hdr-check'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-10T18:58:07Z","receivedAt":"2025-04-10T18:58:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> On 10/04/2025 12:30, Karthik Nayak wrote:\n>> The 'hdr-check' target in meson and makefile is used to check if headers\n>> can be compiled individually. The naming however isn't readable as 'hdr'\n>> is not a common shortforme for 'header', neither is it an abbreviation.\n>> Let's introduce 'headers-check' as an alternative target for\n>> 'hdr-check'\n>> and add a `TODO` to deprecate the latter after 2 releases. Since this\n>> is an internal tool, we can use a shorter deprecation cycle.\n>\n> Can we call this \"check-headers\" to match the other \"check-\" targets\n> in the Makefile please\n\nExcellent suggestion.  If we were to change things, we should get it\nright just once.\n\nThanks.\n"},{"id":"515966","messageId":"xmqqplhjomy6.fsf@gitster.g","threadId":"63271","inReplyTo":"dc0d6acb-bcf1-4a7e-bfc8-7c2e7793c72b@gmail.com","subject":"Re: [PATCH v2 3/4] meson: add support for 'hdr-check'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-10T19:06:57Z","receivedAt":"2025-04-10T19:06:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> Hi Karthik\n>\n> On 10/04/2025 12:30, Karthik Nayak wrote:\n>> The Makefile supports a target called 'hdr-check', which checks if\n>> individual header files can be independently compiled. Let's port this\n>> functionality to meson, our new build system too. The implementation\n>> resembles that of the Makefile and provides the same check.\n>\n> Thanks for adding this, I've left a few comments below\n>\n>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>> ---\n>>   meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>>   1 file changed, 107 insertions(+)\n>> diff --git a/meson.build b/meson.build\n>> index 790d178007..6fce1aa618 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -655,6 +655,12 @@ if git.found()\n>>     endforeach\n>>   endif\n>>   +headers_generated = [\n>\n> To me \"generated_headers\" would be a more natural name and would match\n> the style of \"coccinelle_headers\" from patch 1 as well as the\n> equivalent in the Makefile.\n\nTo me too.\n\n>> ...\n>> +  'xdiff/xtypes.h',\n>> +  'xdiff/xutils.h',\n>> +]\n>\n> Having to manually maintain this list is a bit of a shame as every\n> time a new file is added to compat we need to add it to meson.build\n> twice. The Makefile avoids this by filtering the list of headers used\n> when building git based on their path - can we do the same here?\n\nYup.  It cuts both ways, but generally I would prefer that.  Your\ncreating a new file, and saying \"git add\" on it, should be a sign\nenough that you intend to make it a part of the project, and the\nfile having a name that follows the project convention (e.g., \"C\nheader files are in certain directories and ends with .h\") should be\na sign enough that you want it to be part of the build.  Forcing\npeople to list them explicitly is a pain.\n\nYes, the approach to \"glob\" the list of files used would not help\nyou catch mistakes like forgetting to \"git add\" new files.  You test\nlocally and you commit (without the new file), and you'll be\nnotified by whoever cloned from you about a \"missing file\".  But\nforcing to list the files in Makefile or meson.build would not help\nyou catch that kind of mistake.  While it may give you one more\nchance to remind yourself that you need to \"git add\" by ignoring a\nnew file until you add it to meson.build, if you add it to the file\nbut not to the commit, the build procedure would not complain.\n\nSo, yes, I would pretty much agree with you and prefer to see this\nkind of list go, if possible.\n\nThanks.\n"},{"id":"515991","messageId":"Z_jptp_xj2gpJ65s@pks.im","threadId":"63271","inReplyTo":"20250410-505-wire-up-sparse-via-meson-v2-2-acb45cc8a2e5@gmail.com","subject":"Re: [PATCH v2 2/4] meson: move headers definition from 'contrib/coccinelle'","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-04-11T10:06:46Z","receivedAt":"2025-04-11T10:06:51Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Thu, Apr 10, 2025 at 01:30:32PM +0200, Karthik Nayak wrote:\n> diff --git a/meson.build b/meson.build\n> index e98cfa4909..790d178007 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -633,6 +633,28 @@ builtin_sources = [\n>    'builtin/write-tree.c',\n>  ]\n>  \n> +third_party_sources = [\n> +  ':!contrib',\n> +  ':!compat/inet_ntop.c',\n> +  ':!compat/inet_pton.c',\n> +  ':!compat/nedmalloc',\n> +  ':!compat/obstack.*',\n> +  ':!compat/poll',\n> +  ':!compat/regex',\n> +  ':!sha1collisiondetection',\n> +  ':!sha1dc',\n> +  ':!t/unit-tests/clar',\n> +  ':!t/unit-tests/clar',\n> +  ':!t/t[0-9][0-9][0-9][0-9]*',\n> +]\n> +\n> +headers = []\n\nI think we should make sure that this variable isn't declared at all\nunless `git.found()`. Otherwise, we may accidentally it it even though\nit does not contain anything sensible.\n\nPatrick\n"},{"id":"515992","messageId":"Z_jpvghOGHvw2Y4x@pks.im","threadId":"63271","inReplyTo":"20250410-505-wire-up-sparse-via-meson-v2-3-acb45cc8a2e5@gmail.com","subject":"Re: [PATCH v2 3/4] meson: add support for 'hdr-check'","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-04-11T10:06:54Z","receivedAt":"2025-04-11T10:06:58Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Thu, Apr 10, 2025 at 01:30:33PM +0200, Karthik Nayak wrote:\n> The Makefile supports a target called 'hdr-check', which checks if\n> individual header files can be independently compiled. Let's port this\n> functionality to meson, our new build system too. The implementation\n\nNit: Meson is typically spelt with an upper-case 'M'.\n\n> resembles that of the Makefile and provides the same check.\n> \n> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n> ---\n>  meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 107 insertions(+)\n> \n> diff --git a/meson.build b/meson.build\n> index 790d178007..6fce1aa618 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -655,6 +655,12 @@ if git.found()\n>    endforeach\n>  endif\n>  \n> +headers_generated = [\n> +  'command-list.h',\n> +  'config-list.h',\n> +  'hook-list.h'\n> +]\n> +\n>  if not get_option('breaking_changes')\n>    builtin_sources += 'builtin/pack-redundant.c'\n>  endif\n> @@ -1995,6 +2001,107 @@ endif\n>  \n>  subdir('contrib')\n>  \n> +headers_check_exclude = headers_generated\n> +headers_check_exclude += [\n> +  'compat/apple-common-crypto.h',\n> +  'compat/bswap.h',\n> +  'compat/compiler.h',\n> +  'compat/disk.h',\n> +  'compat/fsmonitor/fsm-darwin-gcc.h',\n> +  'compat/fsmonitor/fsm-health.h',\n> +  'compat/fsmonitor/fsm-listen.h',\n> +  'compat/mingw.h',\n> +  'compat/msvc.h',\n> +  'compat/nedmalloc/malloc.c.h',\n> +  'compat/nedmalloc/nedmalloc.h',\n> +  'compat/nonblock.h',\n> +  'compat/obstack.h',\n> +  'compat/poll/poll.h',\n> +  'compat/precompose_utf8.h',\n> +  'compat/regex/regex.h',\n> +  'compat/regex/regex_internal.h',\n> +  'compat/sha1-chunked.h',\n> +  'compat/terminal.h',\n> +  'compat/vcbuild/include/sys/param.h',\n> +  'compat/vcbuild/include/sys/time.h',\n> +  'compat/vcbuild/include/sys/utime.h',\n> +  'compat/vcbuild/include/unistd.h',\n> +  'compat/vcbuild/include/utime.h',\n> +  'compat/win32.h',\n> +  'compat/win32/alloca.h',\n> +  'compat/win32/dirent.h',\n> +  'compat/win32/lazyload.h',\n> +  'compat/win32/path-utils.h',\n> +  'compat/win32/pthread.h',\n> +  'compat/win32/syslog.h',\n> +  'compat/zlib-compat.h',\n> +  't/unit-tests/clar/clar.h',\n> +  't/unit-tests/clar/clar/fixtures.h',\n> +  't/unit-tests/clar/clar/fs.h',\n> +  't/unit-tests/clar/clar/print.h',\n> +  't/unit-tests/clar/clar/sandbox.h',\n> +  't/unit-tests/clar/clar/summary.h',\n> +  't/unit-tests/clar/test/clar_test.h',\n> +  'unicode-width.h',\n> +  'xdiff/xdiff.h',\n> +  'xdiff/xdiffi.h',\n> +  'xdiff/xemit.h',\n> +  'xdiff/xinclude.h',\n> +  'xdiff/xmacros.h',\n> +  'xdiff/xprepare.h',\n> +  'xdiff/xtypes.h',\n> +  'xdiff/xutils.h',\n> +]\n\nMany of these feel as if they should've been part of\n`third_party_sources`.\n\n> +if sha1_backend != 'openssl'\n> +  headers_check_exclude += 'sha1/openssl.h'\n> +endif\n> +if sha256_backend != 'openssl'\n> +  headers_check_exclude += 'sha256/openssl.h'\n> +endif\n> +if sha256_backend != 'nettle'\n> +  headers_check_exclude += 'sha256/nettle.h'\n> +endif\n> +if sha256_backend != 'gcrpyt'\n> +  headers_check_exclude += 'sha256/gcrypt.h'\n> +endif\n> +\n> +if headers.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n> +  hco_targets = []\n> +  foreach h : headers\n> +    if headers_check_exclude.contains(h)\n> +      continue\n> +    endif\n> +\n> +    hcc = custom_target(\n> +      input: h,\n> +      output: h.underscorify() + 'cc',\n> +      command: [\n> +        shell,\n> +        '-c',\n> +        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo -n \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n> +      ]\n> +    )\n> +\n> +    hco = custom_target(\n> +      input: hcc,\n> +      output: h.underscorify().replace('.h', '.hco'),\n\nYou can use `fs.replace_suffix()` instead of `.replace()`.\n\n> +      command: [\n> +        compiler.cmd_array(),\n> +        libgit_c_args,\n> +        '-I', meson.project_source_root(),\n> +        '-I', meson.project_source_root() / 't/unit-tests',\n> +        '-o', '/dev/null',\n> +        '-c', '-xc',\n> +        '@INPUT@'\n> +      ]\n> +    )\n> +    hco_targets += hco\n> +  endforeach\n> +\n> +  alias_target('hdr-check', hco_targets)\n> +endif\n> +\n>  foreach key, value : {\n>    'DIFF': diff.full_path(),\n>    'GIT_SOURCE_DIR': meson.project_source_root(),\n\nPatrick\n"},{"id":"515996","messageId":"CAOLa=ZQvM+PPJMMmQ2XQrK5Z=j178rJVEY01X0u6ozfgPLhyFQ@mail.gmail.com","threadId":"63271","inReplyTo":"Z_jptp_xj2gpJ65s@pks.im","subject":"Re: [PATCH v2 2/4] meson: move headers definition from 'contrib/coccinelle'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-11T12:13:50Z","receivedAt":"2025-04-11T12:13:52Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> On Thu, Apr 10, 2025 at 01:30:32PM +0200, Karthik Nayak wrote:\n>> diff --git a/meson.build b/meson.build\n>> index e98cfa4909..790d178007 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -633,6 +633,28 @@ builtin_sources = [\n>>    'builtin/write-tree.c',\n>>  ]\n>>\n>> +third_party_sources = [\n>> +  ':!contrib',\n>> +  ':!compat/inet_ntop.c',\n>> +  ':!compat/inet_pton.c',\n>> +  ':!compat/nedmalloc',\n>> +  ':!compat/obstack.*',\n>> +  ':!compat/poll',\n>> +  ':!compat/regex',\n>> +  ':!sha1collisiondetection',\n>> +  ':!sha1dc',\n>> +  ':!t/unit-tests/clar',\n>> +  ':!t/unit-tests/clar',\n>> +  ':!t/t[0-9][0-9][0-9][0-9]*',\n>> +]\n>> +\n>> +headers = []\n>\n> I think we should make sure that this variable isn't declared at all\n> unless `git.found()`. Otherwise, we may accidentally it it even though\n> it does not contain anything sensible.\n>\n\nFair, I wonder if we should treat 'third_party_sources' similarly, but\nsince it is static, it should be fine.\n\n> Patrick\n"},{"id":"516087","messageId":"87mscj5dxe.fsf@iotcl.com","threadId":"63271","inReplyTo":"20250410-505-wire-up-sparse-via-meson-v2-3-acb45cc8a2e5@gmail.com","subject":"Re: [PATCH v2 3/4] meson: add support for 'hdr-check'","fromName":"Toon Claes","fromEmail":"toon@iotcl.com","sentAt":"2025-04-14T08:45:49Z","receivedAt":"2025-04-14T08:46:02Z","isPatch":true,"sender":{"key":"toon@iotcl.com","avatar":"https://avatars.githubusercontent.com/u/121621?v=4"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> The Makefile supports a target called 'hdr-check', which checks if\n> individual header files can be independently compiled. Let's port this\n> functionality to meson, our new build system too. The implementation\n> resembles that of the Makefile and provides the same check.\n>\n> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n> ---\n>  meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 107 insertions(+)\n>\n> diff --git a/meson.build b/meson.build\n> index 790d178007..6fce1aa618 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -655,6 +655,12 @@ if git.found()\n>    endforeach\n>  endif\n>  \n> +headers_generated = [\n> +  'command-list.h',\n> +  'config-list.h',\n> +  'hook-list.h'\n> +]\n\nCan we maybe compose this list by instead doing:\n\n    generated_headers = []\n    foreach f : builtin_sources + libgit_sources + third_party_sources\n      if f.endswith(\".h\")\n        generated_headers += f\n      endif\n    endforeach\n\n(This would take `third_party_sources` into account as suggested by\nPatrick[1]).\n\nIf we consider that too much magic, I would suggest:\n\n    generated_headers = []\n    builtin_sources += custom_target(\n      output: 'config-list.h',\n      command: [\n        shell,\n        meson.current_source_dir() + '/generate-configlist.sh',\n        meson.current_source_dir(),\n        '@OUTPUT@',\n      ],\n      env: script_environment,\n    )\n    generated_headers += 'config-list.h'\n\nI hope this would reduce the chance to forget to add more headers to\nthis list (assuming people copy the code blurb from another location).\n\n--\nToon\n"},{"id":"516099","messageId":"CAOLa=ZQO-7CmeKh13+vxgYnv1dpKvLQnVPf6R3dkujLf+HoMEQ@mail.gmail.com","threadId":"63271","inReplyTo":"dc0d6acb-bcf1-4a7e-bfc8-7c2e7793c72b@gmail.com","subject":"Re: [PATCH v2 3/4] meson: add support for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-14T13:49:31Z","receivedAt":"2025-04-14T13:49:33Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> Hi Karthik\n>\n> On 10/04/2025 12:30, Karthik Nayak wrote:\n>> The Makefile supports a target called 'hdr-check', which checks if\n>> individual header files can be independently compiled. Let's port this\n>> functionality to meson, our new build system too. The implementation\n>> resembles that of the Makefile and provides the same check.\n>\n> Thanks for adding this, I've left a few comments below\n>\n>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>> ---\n>>   meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>>   1 file changed, 107 insertions(+)\n>>\n>> diff --git a/meson.build b/meson.build\n>> index 790d178007..6fce1aa618 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -655,6 +655,12 @@ if git.found()\n>>     endforeach\n>>   endif\n>>\n>> +headers_generated = [\n>\n> To me \"generated_headers\" would be a more natural name and would match\n> the style of \"coccinelle_headers\" from patch 1 as well as the equivalent\n> in the Makefile.\n>\n\nYeah, makes sense, I will swap out the name.\n\n>> +  'command-list.h',\n>> +  'config-list.h',\n>> +  'hook-list.h'\n>> +]\n>> +\n>>   if not get_option('breaking_changes')\n>>     builtin_sources += 'builtin/pack-redundant.c'\n>>   endif\n>> @@ -1995,6 +2001,107 @@ endif\n>>\n>>   subdir('contrib')\n>>\n>> +headers_check_exclude = headers_generated\n>> +headers_check_exclude += [\n>> +  'compat/apple-common-crypto.h',\n>> +  'compat/bswap.h',\n>> +  'compat/compiler.h',\n>> +  'compat/disk.h',\n>> +  'compat/fsmonitor/fsm-darwin-gcc.h',\n>> +  'compat/fsmonitor/fsm-health.h',\n>> +  'compat/fsmonitor/fsm-listen.h',\n>> +  'compat/mingw.h',\n>> +  'compat/msvc.h',\n>> +  'compat/nedmalloc/malloc.c.h',\n>> +  'compat/nedmalloc/nedmalloc.h',\n>> +  'compat/nonblock.h',\n>> +  'compat/obstack.h',\n>> +  'compat/poll/poll.h',\n>> +  'compat/precompose_utf8.h',\n>> +  'compat/regex/regex.h',\n>> +  'compat/regex/regex_internal.h',\n>> +  'compat/sha1-chunked.h',\n>> +  'compat/terminal.h',\n>> +  'compat/vcbuild/include/sys/param.h',\n>> +  'compat/vcbuild/include/sys/time.h',\n>> +  'compat/vcbuild/include/sys/utime.h',\n>> +  'compat/vcbuild/include/unistd.h',\n>> +  'compat/vcbuild/include/utime.h',\n>> +  'compat/win32.h',\n>> +  'compat/win32/alloca.h',\n>> +  'compat/win32/dirent.h',\n>> +  'compat/win32/lazyload.h',\n>> +  'compat/win32/path-utils.h',\n>> +  'compat/win32/pthread.h',\n>> +  'compat/win32/syslog.h',\n>> +  'compat/zlib-compat.h',\n>> +  't/unit-tests/clar/clar.h',\n>> +  't/unit-tests/clar/clar/fixtures.h',\n>> +  't/unit-tests/clar/clar/fs.h',\n>> +  't/unit-tests/clar/clar/print.h',\n>> +  't/unit-tests/clar/clar/sandbox.h',\n>> +  't/unit-tests/clar/clar/summary.h',\n>> +  't/unit-tests/clar/test/clar_test.h',\n>> +  'unicode-width.h',\n>> +  'xdiff/xdiff.h',\n>> +  'xdiff/xdiffi.h',\n>> +  'xdiff/xemit.h',\n>> +  'xdiff/xinclude.h',\n>> +  'xdiff/xmacros.h',\n>> +  'xdiff/xprepare.h',\n>> +  'xdiff/xtypes.h',\n>> +  'xdiff/xutils.h',\n>> +]\n>\n> Having to manually maintain this list is a bit of a shame as every time\n> a new file is added to compat we need to add it to meson.build twice.\n> The Makefile avoids this by filtering the list of headers used when\n> building git based on their path - can we do the same here?\n>\n\nThe ideology in Meson is to list all files explicitly [1] and that was\nwhat I wanted to follow. That said I understand the reasoning, and will\nimplement a glob match in the next version\n\n>> +if sha1_backend != 'openssl'\n>> +  headers_check_exclude += 'sha1/openssl.h'\n>> +endif\n>> +if sha256_backend != 'openssl'\n>> +  headers_check_exclude += 'sha256/openssl.h'\n>> +endif\n>> +if sha256_backend != 'nettle'\n>> +  headers_check_exclude += 'sha256/nettle.h'\n>> +endif\n>> +if sha256_backend != 'gcrpyt'\n>> +  headers_check_exclude += 'sha256/gcrypt.h'\n>> +endif\n>> +\n>> +if headers.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n>> +  hco_targets = []\n>> +  foreach h : headers\n>> +    if headers_check_exclude.contains(h)\n>> +      continue\n>> +    endif\n>> +\n>> +    hcc = custom_target(\n>> +      input: h,\n>> +      output: h.underscorify() + 'cc',\n>> +      command: [\n>> +        shell,\n>> +        '-c',\n>> +        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo -n \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n>\n> This line is rather long. Also do we really need \"echo -n\" here, the\n> Makefile does not use it.\n>\n\nWe can remove it, I was a bit stuck here, because of how meson converts\nback-slash in 'command' [2], I eventually got this working version. But\nthe 'echo -n' can be changed to 'echo'.\n\nRegarding the long line, now sure if there is a better way!\n\n>> +      ]\n>> +    )\n>> +\n>> +    hco = custom_target(\n>> +      input: hcc,\n>> +      output: h.underscorify().replace('.h', '.hco'),\n>> +      command: [\n>> +        compiler.cmd_array(),\n>> +        libgit_c_args,\n>> +        '-I', meson.project_source_root(),\n>> +        '-I', meson.project_source_root() / 't/unit-tests',\n>\n> Do you know why we don't need to add these include paths for the\n> equivalent rule in the Makefile?\n>\n\nBecause the Makefile builds in-tree, so the dependencies are met. Since\nmeson builds are out of tree, we need to explicitly add missing\ndependencies. I'll add this in the commit message.\n\n> Thanks\n>\n> Phillip\n>\n\nThanks for the review!\n\n>> +        '-o', '/dev/null',\n>> +        '-c', '-xc',\n>> +        '@INPUT@'\n>> +      ]\n>> +    )\n>> +    hco_targets += hco\n>> +  endforeach\n>> +\n>> +  alias_target('hdr-check', hco_targets)\n>> +endif\n>> +\n>>   foreach key, value : {\n>>     'DIFF': diff.full_path(),\n>>     'GIT_SOURCE_DIR': meson.project_source_root(),\n>>\n\n[1]: https://mesonbuild.com/FAQ.html#why-cant-i-specify-target-files-with-a-wildcard\n[2]: https://github.com/mesonbuild/meson/issues/1564\n"},{"id":"516100","messageId":"CAOLa=ZRy3eCd+jGjxVGgiYn2xAP0ugJEfzb0zcGt-Wkv4fNbgQ@mail.gmail.com","threadId":"63271","inReplyTo":"Z_jpvghOGHvw2Y4x@pks.im","subject":"Re: [PATCH v2 3/4] meson: add support for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-14T14:03:15Z","receivedAt":"2025-04-14T14:03:17Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> On Thu, Apr 10, 2025 at 01:30:33PM +0200, Karthik Nayak wrote:\n>> The Makefile supports a target called 'hdr-check', which checks if\n>> individual header files can be independently compiled. Let's port this\n>> functionality to meson, our new build system too. The implementation\n>\n> Nit: Meson is typically spelt with an upper-case 'M'.\n>\n\nWill modify throughout the series, thanks!\n\n>> resembles that of the Makefile and provides the same check.\n>>\n>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>> ---\n>>  meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>>  1 file changed, 107 insertions(+)\n>>\n>> diff --git a/meson.build b/meson.build\n>> index 790d178007..6fce1aa618 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -655,6 +655,12 @@ if git.found()\n>>    endforeach\n>>  endif\n>>\n>> +headers_generated = [\n>> +  'command-list.h',\n>> +  'config-list.h',\n>> +  'hook-list.h'\n>> +]\n>> +\n>>  if not get_option('breaking_changes')\n>>    builtin_sources += 'builtin/pack-redundant.c'\n>>  endif\n>> @@ -1995,6 +2001,107 @@ endif\n>>\n>>  subdir('contrib')\n>>\n>> +headers_check_exclude = headers_generated\n>> +headers_check_exclude += [\n>> +  'compat/apple-common-crypto.h',\n>> +  'compat/bswap.h',\n>> +  'compat/compiler.h',\n>> +  'compat/disk.h',\n>> +  'compat/fsmonitor/fsm-darwin-gcc.h',\n>> +  'compat/fsmonitor/fsm-health.h',\n>> +  'compat/fsmonitor/fsm-listen.h',\n>> +  'compat/mingw.h',\n>> +  'compat/msvc.h',\n>> +  'compat/nedmalloc/malloc.c.h',\n>> +  'compat/nedmalloc/nedmalloc.h',\n>> +  'compat/nonblock.h',\n>> +  'compat/obstack.h',\n>> +  'compat/poll/poll.h',\n>> +  'compat/precompose_utf8.h',\n>> +  'compat/regex/regex.h',\n>> +  'compat/regex/regex_internal.h',\n>> +  'compat/sha1-chunked.h',\n>> +  'compat/terminal.h',\n>> +  'compat/vcbuild/include/sys/param.h',\n>> +  'compat/vcbuild/include/sys/time.h',\n>> +  'compat/vcbuild/include/sys/utime.h',\n>> +  'compat/vcbuild/include/unistd.h',\n>> +  'compat/vcbuild/include/utime.h',\n>> +  'compat/win32.h',\n>> +  'compat/win32/alloca.h',\n>> +  'compat/win32/dirent.h',\n>> +  'compat/win32/lazyload.h',\n>> +  'compat/win32/path-utils.h',\n>> +  'compat/win32/pthread.h',\n>> +  'compat/win32/syslog.h',\n>> +  'compat/zlib-compat.h',\n>> +  't/unit-tests/clar/clar.h',\n>> +  't/unit-tests/clar/clar/fixtures.h',\n>> +  't/unit-tests/clar/clar/fs.h',\n>> +  't/unit-tests/clar/clar/print.h',\n>> +  't/unit-tests/clar/clar/sandbox.h',\n>> +  't/unit-tests/clar/clar/summary.h',\n>> +  't/unit-tests/clar/test/clar_test.h',\n>> +  'unicode-width.h',\n>> +  'xdiff/xdiff.h',\n>> +  'xdiff/xdiffi.h',\n>> +  'xdiff/xemit.h',\n>> +  'xdiff/xinclude.h',\n>> +  'xdiff/xmacros.h',\n>> +  'xdiff/xprepare.h',\n>> +  'xdiff/xtypes.h',\n>> +  'xdiff/xutils.h',\n>> +]\n>\n> Many of these feel as if they should've been part of\n> `third_party_sources`.\n>\n\nThe condensed list is now:\n\nexclude_from_check_headers += [\n  'compat/',\n  't/unit-tests/clar/',\n  'unicode-width.h',\n  'xdiff/',\n]\n\nI think from this:\n- compat/: This captures all compat headers, I'm not sure adding all of\n  compat under 'third_party_sources' makes sense though.\n- t/unit-tests/clar/: can be removed, since this is already captured in\n  'third_party_sources'.\n- unicode-width.h: isn't a fit for 'third_party_sources'.\n- xdiff/: will move to 'third_party_sources'.\n\n\n>> +if sha1_backend != 'openssl'\n>> +  headers_check_exclude += 'sha1/openssl.h'\n>> +endif\n>> +if sha256_backend != 'openssl'\n>> +  headers_check_exclude += 'sha256/openssl.h'\n>> +endif\n>> +if sha256_backend != 'nettle'\n>> +  headers_check_exclude += 'sha256/nettle.h'\n>> +endif\n>> +if sha256_backend != 'gcrpyt'\n>> +  headers_check_exclude += 'sha256/gcrypt.h'\n>> +endif\n>> +\n>> +if headers.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n>> +  hco_targets = []\n>> +  foreach h : headers\n>> +    if headers_check_exclude.contains(h)\n>> +      continue\n>> +    endif\n>> +\n>> +    hcc = custom_target(\n>> +      input: h,\n>> +      output: h.underscorify() + 'cc',\n>> +      command: [\n>> +        shell,\n>> +        '-c',\n>> +        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo -n \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n>> +      ]\n>> +    )\n>> +\n>> +    hco = custom_target(\n>> +      input: hcc,\n>> +      output: h.underscorify().replace('.h', '.hco'),\n>\n> You can use `fs.replace_suffix()` instead of `.replace()`.\n>\n\nNice, will do.\n\n>> +      command: [\n>> +        compiler.cmd_array(),\n>> +        libgit_c_args,\n>> +        '-I', meson.project_source_root(),\n>> +        '-I', meson.project_source_root() / 't/unit-tests',\n>> +        '-o', '/dev/null',\n>> +        '-c', '-xc',\n>> +        '@INPUT@'\n>> +      ]\n>> +    )\n>> +    hco_targets += hco\n>> +  endforeach\n>> +\n>> +  alias_target('hdr-check', hco_targets)\n>> +endif\n>> +\n>>  foreach key, value : {\n>>    'DIFF': diff.full_path(),\n>>    'GIT_SOURCE_DIR': meson.project_source_root(),\n>\n> Patrick\n"},{"id":"516101","messageId":"CAOLa=ZQTwqyAU2cSFCQL4Ofc+dVyT5h6x5Ojyi=Bo6uYqze3Vg@mail.gmail.com","threadId":"63271","inReplyTo":"87mscj5dxe.fsf@iotcl.com","subject":"Re: [PATCH v2 3/4] meson: add support for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-14T14:25:45Z","receivedAt":"2025-04-14T14:25:48Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Toon Claes <toon@iotcl.com> writes:\n\n> Karthik Nayak <karthik.188@gmail.com> writes:\n>\n>> The Makefile supports a target called 'hdr-check', which checks if\n>> individual header files can be independently compiled. Let's port this\n>> functionality to meson, our new build system too. The implementation\n>> resembles that of the Makefile and provides the same check.\n>>\n>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>> ---\n>>  meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>>  1 file changed, 107 insertions(+)\n>>\n>> diff --git a/meson.build b/meson.build\n>> index 790d178007..6fce1aa618 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -655,6 +655,12 @@ if git.found()\n>>    endforeach\n>>  endif\n>>\n>> +headers_generated = [\n>> +  'command-list.h',\n>> +  'config-list.h',\n>> +  'hook-list.h'\n>> +]\n>\n> Can we maybe compose this list by instead doing:\n>\n>     generated_headers = []\n>     foreach f : builtin_sources + libgit_sources + third_party_sources\n>       if f.endswith(\".h\")\n>         generated_headers += f\n>       endif\n>     endforeach\n>\n> (This would take `third_party_sources` into account as suggested by\n> Patrick[1]).\n>\n\nThis does make sense, but this also feels like an overkill to only get\nthree headers.\n\n> If we consider that too much magic, I would suggest:\n>\n>     generated_headers = []\n>     builtin_sources += custom_target(\n>       output: 'config-list.h',\n>       command: [\n>         shell,\n>         meson.current_source_dir() + '/generate-configlist.sh',\n>         meson.current_source_dir(),\n>         '@OUTPUT@',\n>       ],\n>       env: script_environment,\n>     )\n>     generated_headers += 'config-list.h'\n>\n> I hope this would reduce the chance to forget to add more headers to\n> this list (assuming people copy the code blurb from another location).\n>\n\nThis looks nice, Let me modify accordingly!\n\n> --\n> Toon\n"},{"id":"516102","messageId":"CAOLa=ZQNrqf+cqatpbW7jeX6e7XAmk7NZZBH1inYMCjFj23C-Q@mail.gmail.com","threadId":"63271","inReplyTo":"xmqqtt6voncw.fsf@gitster.g","subject":"Re: [PATCH v2 4/4] makefile/meson: add 'headers-check' as alias for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-14T14:27:20Z","receivedAt":"2025-04-14T14:27:22Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n>\n>> On 10/04/2025 12:30, Karthik Nayak wrote:\n>>> The 'hdr-check' target in meson and makefile is used to check if headers\n>>> can be compiled individually. The naming however isn't readable as 'hdr'\n>>> is not a common shortforme for 'header', neither is it an abbreviation.\n>>> Let's introduce 'headers-check' as an alternative target for\n>>> 'hdr-check'\n>>> and add a `TODO` to deprecate the latter after 2 releases. Since this\n>>> is an internal tool, we can use a shorter deprecation cycle.\n>>\n>> Can we call this \"check-headers\" to match the other \"check-\" targets\n>> in the Makefile please\n>\n> Excellent suggestion.  If we were to change things, we should get it\n> right just once.\n>\n> Thanks.\n\nYeah I agree too, I based it off 'coccicheck', but seems like 'check-*'\nis more consistent.\n\nThanks\n"},{"id":"516404","messageId":"20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com","threadId":"63271","inReplyTo":"20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com","subject":"[PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-20T12:21:32Z","receivedAt":"2025-04-20T13:19:38Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"To bridge the remaining gaps between Makefile and Meson, this patch\nseries adds 'hdr-check' to Meson to compliment the Makefile's\n'hdr-check'.\n\nWe also introduce 'headers-check' as an alias to 'hdr-check' as a better\nnamed replacement in both Meson and make and add a note to deprecate\n'hdr-check' in the future.\n\nThe first two commits are small cleanups, where we re-organize existing\nvariables to make it easier to add the target. The third commit adds the\n'hdr-check' target to Meson. The last commit introduces the\n'headers-check' alias to both Meson and the makefile and marks\n'hdr-check' to be deprecated.\n\nThis is based on master 9d22ac5122 (The third batch, 2025-04-07) with\n'es/meson-build-skip-coccinelle' merged in.\n\n---\nChanges in v4:\n- Rename headers to headers_to_check, since these headers are only used\n  for static analysis.\n- Added a commit to rename third_party_sources -> third_party_excludes\n  and remove a duplicate.\n- Fix a typo 'gcrpyt' -> 'gcrypt'\n- Remove 'generated_headers', since we use 'git ls-files' and that would\n  already ignore files within '.gitignore'.\n- Link to v3: https://lore.kernel.org/r/20250414-505-wire-up-sparse-via-meson-v3-0-edc6e7f26745@gmail.com\n\nChanges in v3:\n- Some renames:\n  - headers_generated -> generated_headers\n  - meson -> Meson\n  - headers-check -> check-headers\n  - headers_check_exclude -> exclude_from_check_headers\n- Rewrite 'headers_check_exclude' to also contain dirs so we can skip\n  listing individual header files.\n- Move 'xdiff/*' to 'third_party_sources' and cleanup\n  'exclude_from_check_headers'.\n- Use 'echo' instead of 'echo -n'.\n- Use `fs.replace_suffix` instead of `str.replace`.\n- Link to v2: https://lore.kernel.org/r/20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com\n\nChanges in v2:\n- Add 'hdr-check' to meson, while introducing 'headers-check' as\n  a replacement alias. Schedule 'hdr-check' to be deprecated in the future.\n- Link to v1: https://lore.kernel.org/r/20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com\n\n---\n Makefile                       |  4 +-\n ci/run-static-analysis.sh      |  2 +-\n contrib/coccinelle/meson.build | 31 ++++-----------\n meson.build                    | 86 ++++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 98 insertions(+), 25 deletions(-)\n\nKarthik Nayak (5):\n      coccinelle: meson: rename variables to be more specific\n      meson: move headers definition from 'contrib/coccinelle'\n      meson: rename 'third_party_sources' to 'third_party_excludes'\n      meson: add support for 'hdr-check'\n      makefile/meson: add 'check-headers' as alias for 'hdr-check'\n\nRange-diff versus v3:\n\n1:  bc69638da5 = 1:  337431cf0f coccinelle: meson: rename variables to be more specific\n2:  de50343e66 ! 2:  2b5bde0cb0 meson: move headers definition from 'contrib/coccinelle'\n    @@ contrib/coccinelle/meson.build: foreach source : run_command(git, '-C', meson.pr\n      \n      coccinelle_headers = []\n     -foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n    -+foreach header : headers\n    ++foreach header : headers_to_check\n        coccinelle_headers += meson.project_source_root() / header\n      endforeach\n      \n    @@ meson.build: builtin_sources = [\n     +]\n     +\n     +if git.found()\n    -+  headers = []\n    ++  headers_to_check = []\n     +  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n    -+    headers += header\n    ++    headers_to_check += header\n     +  endforeach\n     +endif\n     +\n-:  ---------- > 3:  2c5c9a9dc8 meson: rename 'third_party_sources' to 'third_party_excludes'\n3:  fadfc7ef07 ! 4:  5b166c8bcd meson: add support for 'hdr-check'\n    @@ Commit message\n         the required dependencies.\n     \n         Also add the 'xdiff/' dir to the list of 'third_party_sources' as those\n    -    headers must be skipped from the checks too!\n    +    headers must be skipped from the checks too. This also skips the folder\n    +    from the 'coccinelle' checks, this is okay, since this code is an\n    +    external dependency.\n     \n         Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n     \n      ## meson.build ##\n    -@@ meson.build: third_party_sources = [\n    -   ':!t/unit-tests/clar',\n    +@@ meson.build: third_party_excludes = [\n    +   ':!sha1dc',\n        ':!t/unit-tests/clar',\n        ':!t/t[0-9][0-9][0-9][0-9]*',\n     +  ':!xdiff',\n      ]\n      \n      if git.found()\n    -@@ meson.build: if git.found()\n    -   endforeach\n    - endif\n    - \n    -+generated_headers = [\n    -+  'command-list.h',\n    -+]\n    -+\n    - if not get_option('breaking_changes')\n    -   builtin_sources += 'builtin/pack-redundant.c'\n    - endif\n    -@@ meson.build: builtin_sources += custom_target(\n    -   ],\n    -   env: script_environment,\n    - )\n    -+generated_headers += 'config-list.h'\n    - \n    - builtin_sources += custom_target(\n    -   input: 'Documentation/githooks.adoc',\n    -@@ meson.build: builtin_sources += custom_target(\n    -   ],\n    -   env: script_environment,\n    - )\n    -+generated_headers += 'hook-list.h'\n    - \n    - # This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate\n    - # build options to our tests.\n     @@ meson.build: endif\n      \n      subdir('contrib')\n      \n    -+exclude_from_check_headers = generated_headers\n    -+exclude_from_check_headers += [\n    ++exclude_from_check_headers = [\n     +  'compat/',\n     +  'unicode-width.h',\n     +]\n    @@ meson.build: endif\n     +if sha256_backend != 'nettle'\n     +  exclude_from_check_headers += 'sha256/nettle.h'\n     +endif\n    -+if sha256_backend != 'gcrpyt'\n    ++if sha256_backend != 'gcrypt'\n     +  exclude_from_check_headers += 'sha256/gcrypt.h'\n     +endif\n     +\n     +if git.found() and compiler.get_argument_syntax() == 'gcc'\n     +  hco_targets = []\n    -+  foreach h : headers\n    ++  foreach h : headers_to_check\n     +    skip_header = false\n     +    foreach exclude : exclude_from_check_headers\n     +      if h.startswith(exclude)\n4:  66c5798df7 ! 5:  97e2e46dc1 makefile/meson: add 'check-headers' as alias for 'hdr-check'\n    @@ meson.build: if git.found() and compiler.get_argument_syntax() == 'gcc'\n          hco_targets += hco\n        endforeach\n      \n    +-  alias_target('hdr-check', hco_targets)\n     +  # TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+\n    -   alias_target('hdr-check', hco_targets)\n    -+  alias_target('check-headers', hco_targets)\n    ++  hdr_check = alias_target('hdr-check', hco_targets)\n    ++  alias_target('check-headers', hdr_check)\n      endif\n      \n      foreach key, value : {\n\n\nbase-commit: 3a956c5f69873611ae5f8dcb9acd117f66b95ddc\nchange-id: 20250330-505-wire-up-sparse-via-meson-2e32dd31208b\n\nThanks\n- Karthik\n\n"},{"id":"516405","messageId":"20250420-505-wire-up-sparse-via-meson-v4-1-66e14134e822@gmail.com","threadId":"63271","inReplyTo":"20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com","subject":"[PATCH v4 1/5] coccinelle: meson: rename variables to be more specific","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-20T12:21:33Z","receivedAt":"2025-04-20T13:19:38Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"In Meson, included subdirs export their variables to top level Meson\nbuilds. In 'contrib/coccinelle/meson.build', we define two such\nvariables `sources` and `headers`. While these variables are specific to\nthe checks in the 'contrib/coccinelle/' directory, they also pollute the\ntop level 'meson.build'.\n\nRename them to be more specific, this ensures that they aren't\nmistakenly used in the upper levels and avoid variable name collisions.\n\nWhile here, change the empty list denotation to be consistent with other\nplaces.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex ea054c924f..03ce52d752 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -55,18 +55,18 @@ concatenated_rules = custom_target(\n   capture: true,\n )\n \n-sources = [ ]\n+coccinelle_sources = []\n foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()\n-  sources += source\n+  coccinelle_sources += source\n endforeach\n \n-headers = [ ]\n+coccinelle_headers = []\n foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n-  headers += meson.project_source_root() / header\n+  coccinelle_headers += meson.project_source_root() / header\n endforeach\n \n patches = [ ]\n-foreach source : sources\n+foreach source : coccinelle_sources\n   patches += custom_target(\n     command: [\n       spatch,\n@@ -78,7 +78,7 @@ foreach source : sources\n     input: meson.project_source_root() / source,\n     output: source.underscorify() + '.patch',\n     capture: true,\n-    depend_files: headers,\n+    depend_files: coccinelle_headers,\n   )\n endforeach\n \n\n-- \n2.48.1\n\n"},{"id":"516406","messageId":"20250420-505-wire-up-sparse-via-meson-v4-2-66e14134e822@gmail.com","threadId":"63271","inReplyTo":"20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com","subject":"[PATCH v4 2/5] meson: move headers definition from 'contrib/coccinelle'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-20T12:21:34Z","receivedAt":"2025-04-20T13:19:39Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The Meson build for coccinelle static analysis lists all headers to\nanalyse. Due to the way Meson exports variables between subdirs, this\nvariable is also available in the root Meson build.\n\nAn upcoming commit, will add a new check complimenting 'hdr-check' in\nthe Makefile. This would require the list of headers. So move the\n'coccinelle_headers' to the root Meson build and rename it to 'headers',\nremove the root path being appended to each header and retain that in\nthe coccinelle Meson build since it is specific to the coccinelle build.\n\nAlso move the 'third_party_sources' variable to the root Meson build\nsince it is also a dependency for the 'headers' variable. This also\nmakes it easier to understand as the variable is now propagated from the\ntop level to the bottom.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 17 +----------------\n meson.build                    | 22 ++++++++++++++++++++++\n 2 files changed, 23 insertions(+), 16 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex 03ce52d752..4f07824402 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -8,21 +8,6 @@ if not spatch.found()\n   subdir_done()\n endif\n \n-third_party_sources = [\n-  ':!contrib',\n-  ':!compat/inet_ntop.c',\n-  ':!compat/inet_pton.c',\n-  ':!compat/nedmalloc',\n-  ':!compat/obstack.*',\n-  ':!compat/poll',\n-  ':!compat/regex',\n-  ':!sha1collisiondetection',\n-  ':!sha1dc',\n-  ':!t/unit-tests/clar',\n-  ':!t/unit-tests/clar',\n-  ':!t/t[0-9][0-9][0-9][0-9]*',\n-]\n-\n rules = [\n   'array.cocci',\n   'commit.cocci',\n@@ -61,7 +46,7 @@ foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files',\n endforeach\n \n coccinelle_headers = []\n-foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+foreach header : headers_to_check\n   coccinelle_headers += meson.project_source_root() / header\n endforeach\n \ndiff --git a/meson.build b/meson.build\nindex e98cfa4909..66ee6fb096 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -633,6 +633,28 @@ builtin_sources = [\n   'builtin/write-tree.c',\n ]\n \n+third_party_sources = [\n+  ':!contrib',\n+  ':!compat/inet_ntop.c',\n+  ':!compat/inet_pton.c',\n+  ':!compat/nedmalloc',\n+  ':!compat/obstack.*',\n+  ':!compat/poll',\n+  ':!compat/regex',\n+  ':!sha1collisiondetection',\n+  ':!sha1dc',\n+  ':!t/unit-tests/clar',\n+  ':!t/unit-tests/clar',\n+  ':!t/t[0-9][0-9][0-9][0-9]*',\n+]\n+\n+if git.found()\n+  headers_to_check = []\n+  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+    headers_to_check += header\n+  endforeach\n+endif\n+\n if not get_option('breaking_changes')\n   builtin_sources += 'builtin/pack-redundant.c'\n endif\n\n-- \n2.48.1\n\n"},{"id":"516409","messageId":"20250420-505-wire-up-sparse-via-meson-v4-3-66e14134e822@gmail.com","threadId":"63271","inReplyTo":"20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com","subject":"[PATCH v4 3/5] meson: rename 'third_party_sources' to 'third_party_excludes'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-20T12:21:35Z","receivedAt":"2025-04-20T13:19:40Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 'third_party_sources' variable was moved to the root 'meson.build'\nfile in the previous commit. The variable is actually used to exclude\nthird party sources, so rename it accordingly to 'third_party_excludes'\nto avoid confusion. While here, remove a duplicate from the list.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 2 +-\n meson.build                    | 5 ++---\n 2 files changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex 4f07824402..dc3f73c2e7 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -41,7 +41,7 @@ concatenated_rules = custom_target(\n )\n \n coccinelle_sources = []\n-foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()\n+foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_excludes, check: true).stdout().split()\n   coccinelle_sources += source\n endforeach\n \ndiff --git a/meson.build b/meson.build\nindex 66ee6fb096..c4dcf756b3 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -633,7 +633,7 @@ builtin_sources = [\n   'builtin/write-tree.c',\n ]\n \n-third_party_sources = [\n+third_party_excludes = [\n   ':!contrib',\n   ':!compat/inet_ntop.c',\n   ':!compat/inet_pton.c',\n@@ -644,13 +644,12 @@ third_party_sources = [\n   ':!sha1collisiondetection',\n   ':!sha1dc',\n   ':!t/unit-tests/clar',\n-  ':!t/unit-tests/clar',\n   ':!t/t[0-9][0-9][0-9][0-9]*',\n ]\n \n if git.found()\n   headers_to_check = []\n-  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_excludes, check: true).stdout().split()\n     headers_to_check += header\n   endforeach\n endif\n\n-- \n2.48.1\n\n"},{"id":"516407","messageId":"20250420-505-wire-up-sparse-via-meson-v4-5-66e14134e822@gmail.com","threadId":"63271","inReplyTo":"20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com","subject":"[PATCH v4 5/5] makefile/meson: add 'check-headers' as alias for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-20T12:21:37Z","receivedAt":"2025-04-20T13:19:41Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 'hdr-check' target in Meson and makefile is used to check if headers\ncan be compiled individually. The naming however isn't readable as 'hdr'\nis not a common shortforme for 'header', neither is it an abbreviation.\n\nLet's introduce 'check-headers' as an alternative target for 'hdr-check'\nand add a `TODO` to deprecate the latter after 2 releases. Since this\nis an internal tool, we can use a shorter deprecation cycle.\n\nChange existing usage of 'hdr-check' in 'ci/run-static-analysis.sh' to\nalso use 'check-headers'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n Makefile                  | 4 +++-\n ci/run-static-analysis.sh | 2 +-\n meson.build               | 4 +++-\n 3 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex ac32d2d0bd..961ee508be 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3326,8 +3326,10 @@ HCC = $(HCO:hco=hcc)\n $(HCO): %.hco: %.hcc $(GENERATED_H) FORCE\n \t$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<\n \n-.PHONY: hdr-check $(HCO)\n+# TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+\n+.PHONY: hdr-check check-headers $(HCO)\n hdr-check: $(HCO)\n+check-headers: hdr-check\n \n .PHONY: style\n style:\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 0d51e5ce0e..60c175a094 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -26,7 +26,7 @@ then\n \texit 1\n fi\n \n-make hdr-check ||\n+make check-headers ||\n exit 1\n \n make check-pot\ndiff --git a/meson.build b/meson.build\nindex afbdc97fb6..39319e2610 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -2054,7 +2054,9 @@ if git.found() and compiler.get_argument_syntax() == 'gcc'\n     hco_targets += hco\n   endforeach\n \n-  alias_target('hdr-check', hco_targets)\n+  # TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+\n+  hdr_check = alias_target('hdr-check', hco_targets)\n+  alias_target('check-headers', hdr_check)\n endif\n \n foreach key, value : {\n\n-- \n2.48.1\n\n"},{"id":"516408","messageId":"20250420-505-wire-up-sparse-via-meson-v4-4-66e14134e822@gmail.com","threadId":"63271","inReplyTo":"20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com","subject":"[PATCH v4 4/5] meson: add support for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-20T12:21:36Z","receivedAt":"2025-04-20T13:19:41Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The Makefile supports a target called 'hdr-check', which checks if\nindividual header files can be independently compiled. Let's port this\nfunctionality to Meson, our new build system too. The implementation\nresembles that of the Makefile and provides the same check.\n\nSince meson builds are out-of-tree, header dependencies are not\nautomatically met. So unlike the Makefile version, we also need to add\nthe required dependencies.\n\nAlso add the 'xdiff/' dir to the list of 'third_party_sources' as those\nheaders must be skipped from the checks too. This also skips the folder\nfrom the 'coccinelle' checks, this is okay, since this code is an\nexternal dependency.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n meson.build | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 63 insertions(+)\n\ndiff --git a/meson.build b/meson.build\nindex c4dcf756b3..afbdc97fb6 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -645,6 +645,7 @@ third_party_excludes = [\n   ':!sha1dc',\n   ':!t/unit-tests/clar',\n   ':!t/t[0-9][0-9][0-9][0-9]*',\n+  ':!xdiff',\n ]\n \n if git.found()\n@@ -1994,6 +1995,68 @@ endif\n \n subdir('contrib')\n \n+exclude_from_check_headers = [\n+  'compat/',\n+  'unicode-width.h',\n+]\n+\n+if sha1_backend != 'openssl'\n+  exclude_from_check_headers += 'sha1/openssl.h'\n+endif\n+if sha256_backend != 'openssl'\n+  exclude_from_check_headers += 'sha256/openssl.h'\n+endif\n+if sha256_backend != 'nettle'\n+  exclude_from_check_headers += 'sha256/nettle.h'\n+endif\n+if sha256_backend != 'gcrypt'\n+  exclude_from_check_headers += 'sha256/gcrypt.h'\n+endif\n+\n+if git.found() and compiler.get_argument_syntax() == 'gcc'\n+  hco_targets = []\n+  foreach h : headers_to_check\n+    skip_header = false\n+    foreach exclude : exclude_from_check_headers\n+      if h.startswith(exclude)\n+        skip_header = true\n+        break\n+      endif\n+    endforeach\n+\n+    if skip_header\n+      continue\n+    endif\n+\n+    hcc = custom_target(\n+      input: h,\n+      output: h.underscorify() + 'cc',\n+      command: [\n+        shell,\n+        '-c',\n+        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n+      ]\n+    )\n+\n+    hco = custom_target(\n+      input: hcc,\n+      output: fs.replace_suffix(h.underscorify(), '.hco'),\n+      command: [\n+        compiler.cmd_array(),\n+        libgit_c_args,\n+        '-I', meson.project_source_root(),\n+        '-I', meson.project_source_root() / 't/unit-tests',\n+        '-o', '/dev/null',\n+        '-c', '-xc',\n+        '@INPUT@'\n+      ]\n+    )\n+    hco_targets += hco\n+  endforeach\n+\n+  alias_target('hdr-check', hco_targets)\n+endif\n+\n foreach key, value : {\n   'DIFF': diff.full_path(),\n   'GIT_SOURCE_DIR': meson.project_source_root(),\n\n-- \n2.48.1\n\n"},{"id":"516419","messageId":"xmqqh62i6jli.fsf@gitster.g","threadId":"63271","inReplyTo":"20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-21T07:48:25Z","receivedAt":"2025-04-21T07:48:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> This is based on master 9d22ac5122 (The third batch, 2025-04-07) with\n> 'es/meson-build-skip-coccinelle' merged in.\n>\n> ---\n> Changes in v4:\n> - Rename headers to headers_to_check, since these headers are only used\n>   for static analysis.\n> - Added a commit to rename third_party_sources -> third_party_excludes\n>   and remove a duplicate.\n> - Fix a typo 'gcrpyt' -> 'gcrypt'\n> - Remove 'generated_headers', since we use 'git ls-files' and that would\n>   already ignore files within '.gitignore'.\n> - Link to v3: https://lore.kernel.org/r/20250414-505-wire-up-sparse-via-meson-v3-0-edc6e7f26745@gmail.com\n>\n> Changes in v3:\n> - Some renames:\n>   - headers_generated -> generated_headers\n>   - meson -> Meson\n>   - headers-check -> check-headers\n>   - headers_check_exclude -> exclude_from_check_headers\n> - Rewrite 'headers_check_exclude' to also contain dirs so we can skip\n>   listing individual header files.\n> - Move 'xdiff/*' to 'third_party_sources' and cleanup\n>   'exclude_from_check_headers'.\n> - Use 'echo' instead of 'echo -n'.\n> - Use `fs.replace_suffix` instead of `str.replace`.\n> - Link to v2: https://lore.kernel.org/r/20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com\n\nLike the previous round, this round also seems to break linux.meson\njob at GitHub Actions CI when merged to 'seen'.  It may be quite\npossible that it is caused by some semantic conflicts, and help to\nfind where the merged result is wrong is very much appreciated.\n\nFor now, I've ejected the topic out of 'seen' again.\n\nFailing CI run:\n\nhttps://github.com/git/git/actions/runs/14563669225/job/40850047961\n\nThe same 'seen' without the merge of this topic:\n\nhttps://github.com/git/git/actions/runs/14564707024/job/40852298435\n\nNote that I expect win+Meson test (3) job to fail/time-out even\nwithout this topic.  I do not know how the numbered test jobs for\nwin+Meson part of the CI are sharded, but one of them never finishes\nin 'next' so this topic is unlikely to be the cause of the breakage.\n\nAddendum.\n\nThe topic alone, rebuilt as specified in your cover letter, seems to\nbe sufficient to make linux-meson job fail, without any interaction\nwith other topics in 'seen'.\n\nhttps://github.com/git/git/actions/runs/14566676782/job/40856998621\n\nNote that we have unrelated breakages like pedantic (due to update to\nthe fedora image) and sparse (due to deprecation of the ubuntu\nimage) we fixed since the base commit you picked, so failures of\nthese jobs are not all that interesting in this run.  But the\nbreakage of linux-meson job is unique to this topic.\n\nInterestingly, either this topic alone or 'seen' with this topic I\nhaven't seen the \"meson setup + compile + test\" sequence in my local\ntesting, so the breakage seems to be isolated to the CI job.\n"},{"id":"516420","messageId":"8b380da4-8d27-4efe-85fd-3bb599188fe9@gmail.com","threadId":"63271","inReplyTo":"xmqqh62i6jli.fsf@gitster.g","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-21T08:45:59Z","receivedAt":"2025-04-21T08:46:06Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 21/04/2025 08:48, Junio C Hamano wrote:\n> Karthik Nayak <karthik.188@gmail.com> writes:\n> \n>> This is based on master 9d22ac5122 (The third batch, 2025-04-07) with\n>> 'es/meson-build-skip-coccinelle' merged in.\n>>\n> \n> Like the previous round, this round also seems to break linux.meson\n> job at GitHub Actions CI when merged to 'seen'.  It may be quite\n> possible that it is caused by some semantic conflicts, and help to\n> find where the merged result is wrong is very much appreciated.\n> \n> For now, I've ejected the topic out of 'seen' again.\n> \n> Failing CI run:\n> \n> https://github.com/git/git/actions/runs/14563669225/job/40850047961\n> \n\n\"git ls-files\" is complaining that there isn't a git repository. Looking \nat the output of the checkout action (reproduced below) it appears it is \nextracting a tarball rather than using \"git clone\" because git is not \navailable. I don't know what the best way to fix that is - I guess we \ncould run \"apt-get install git\" before calling the checkout action.\n\nBest Wishes\n\nPhillip\n\n\nRun actions/checkout@v4\n/usr/bin/docker exec \n6334961fdc01ddadb7a7af1fadd8ae33a6fce79b7428255d2231145f5e09f51d sh -c \n\"cat /etc/*release | grep ^ID\"\nSyncing repository: git/git\nGetting Git version info\n   Working directory is '/__w/git/git'\nDeleting the contents of '/__w/git/git'\nThe repository will be downloaded using the GitHub REST API\nTo create a local Git repository instead, add Git 2.18 or higher to the PATH\nDownloading the archive\nWriting archive to disk\nExtracting the archive\n/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C \n/__w/git/git/23521f8f-82bd-4a9b-994a-cacfd7101756 -f \n/__w/git/git/23521f8f-82bd-4a9b-994a-cacfd7101756.tar.gz\nResolved version git-git-c9e21a0\n\n"},{"id":"516431","messageId":"CAOLa=ZSR=7TEWLHa-wzBB4x+4+-BH3UC3G7s24Bc26JH63QKOA@mail.gmail.com","threadId":"63271","inReplyTo":"8b380da4-8d27-4efe-85fd-3bb599188fe9@gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-21T15:33:11Z","receivedAt":"2025-04-21T15:33:14Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> On 21/04/2025 08:48, Junio C Hamano wrote:\n>> Karthik Nayak <karthik.188@gmail.com> writes:\n>>\n>>> This is based on master 9d22ac5122 (The third batch, 2025-04-07) with\n>>> 'es/meson-build-skip-coccinelle' merged in.\n>>>\n>>\n>> Like the previous round, this round also seems to break linux.meson\n>> job at GitHub Actions CI when merged to 'seen'.  It may be quite\n>> possible that it is caused by some semantic conflicts, and help to\n>> find where the merged result is wrong is very much appreciated.\n>>\n>> For now, I've ejected the topic out of 'seen' again.\n>>\n>> Failing CI run:\n>>\n>> https://github.com/git/git/actions/runs/14563669225/job/40850047961\n>>\n>\n> \"git ls-files\" is complaining that there isn't a git repository. Looking\n> at the output of the checkout action (reproduced below) it appears it is\n> extracting a tarball rather than using \"git clone\" because git is not\n> available. I don't know what the best way to fix that is - I guess we\n> could run \"apt-get install git\" before calling the checkout action.\n>\n> Best Wishes\n>\n> Phillip\n>\n>\n> Run actions/checkout@v4\n> /usr/bin/docker exec\n> 6334961fdc01ddadb7a7af1fadd8ae33a6fce79b7428255d2231145f5e09f51d sh -c\n> \"cat /etc/*release | grep ^ID\"\n> Syncing repository: git/git\n> Getting Git version info\n>    Working directory is '/__w/git/git'\n> Deleting the contents of '/__w/git/git'\n> The repository will be downloaded using the GitHub REST API\n> To create a local Git repository instead, add Git 2.18 or higher to the PATH\n> Downloading the archive\n> Writing archive to disk\n> Extracting the archive\n> /usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C\n> /__w/git/git/23521f8f-82bd-4a9b-994a-cacfd7101756 -f\n> /__w/git/git/23521f8f-82bd-4a9b-994a-cacfd7101756.tar.gz\n> Resolved version git-git-c9e21a0\n\nYup, this seems to be the reason, I was primarily using GitLab CI for\nensuring everything was working, apart from locally testing it. Seems\nlike there is no issues on GitLab CI:\n\n  https://gitlab.com/gitlab-org/git/-/pipelines/1777164771\n\nSo the only difference, is that, like you mentioned, GitHub strips the\nrepository information by downloading a tar file using the REST API. The\nreason seems to be due to missing the 'git' executable:\n\n  https://github.com/actions/checkout/issues/363\n\nI tested this with the following patch, which seems to fix the issue at\nhand. Will send in a new version with this patch, once I validate all\nthe tests.\n\n-- >8 --\n\ncommit b4567cac2b5eb5e9b50b468a85854bad66a9f445\nAuthor: Karthik Nayak <karthik.188@gmail.com>\nDate:   Mon Apr 21 13:06:45 2025 +0200\n\n    ci/github: install git before checking out the repository\n\n    The GitHub CI workflow uses 'actions/checkout@v4' to checkout the\n    repository. This action defaults to using the GitHub REST API to obtain\n    the repository if Git isn't present. The REST API downloads a tar of the\n    repository sans the Git information. Since we don't install Git before\n    this step, using the REST API is the current behavior.\n\n    The following commits will add the 'hdr-check' static check to meson.\n    The check will use 'git ls-files' to obtain the set of header files.\n    This will fail if the repository doesn't contain the Git directory. So\n    install Git before running the 'actions/checkout@v4' action.\n\n    Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 37541f3d10..a09fcf4d72 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -414,6 +414,16 @@ jobs:\n     - name: prepare libc6 for actions\n       if: matrix.vector.jobname == 'linux32'\n       run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6\n+    - name: install git in container\n+      run: |\n+        if [ -f /etc/alpine-release ]; then\n+          apk update && apk add --no-cache git\n+        elif [ -f /etc/almalinux-release ] || [ -f /etc/redhat-release ]; then\n+           dnf -y install git\n+        else\n+          apt -q update && apt -q -y install git\n+        fi\n+        git config --global --add safe.directory \"$GITHUB_WORKSPACE\"\n     - uses: actions/checkout@v4\n     - run: ci/install-dependencies.sh\n     - run: useradd builder --create-home\n"},{"id":"516432","messageId":"xmqq8qnt7c9w.fsf@gitster.g","threadId":"63271","inReplyTo":"8b380da4-8d27-4efe-85fd-3bb599188fe9@gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-21T15:41:15Z","receivedAt":"2025-04-21T15:41:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> \"git ls-files\" is complaining that there isn't a git\n> repository. Looking at the output of the checkout action (reproduced\n> below) it appears it is extracting a tarball rather than using \"git\n> clone\" because git is not available. I don't know what the best way to\n> fix that is - I guess we could run \"apt-get install git\" before\n> calling the checkout action.\n\nInteresting.  The use of actions/checkout@v4 is nothing new in\nKarthik's series and we haven't seen this issue come up.  What's so\ndifferent with this particular series, I have to wonder...\n\nThanks.\n"},{"id":"516440","messageId":"3389d086-4e6e-4896-94dd-9f62d7c4f2df@gmail.com","threadId":"63271","inReplyTo":"xmqq8qnt7c9w.fsf@gitster.g","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-21T18:54:16Z","receivedAt":"2025-04-21T18:54:22Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"\n\nOn 21/04/2025 16:41, Junio C Hamano wrote:\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n> \n>> \"git ls-files\" is complaining that there isn't a git\n>> repository. Looking at the output of the checkout action (reproduced\n>> below) it appears it is extracting a tarball rather than using \"git\n>> clone\" because git is not available. I don't know what the best way to\n>> fix that is - I guess we could run \"apt-get install git\" before\n>> calling the checkout action.\n> \n> Interesting.  The use of actions/checkout@v4 is nothing new in\n> Karthik's series and we haven't seen this issue come up.  What's so\n> different with this particular series, I have to wonder...\n\nGood Question. Looking at contrib/coccinelle/meson.build which is where \nthe invocation of \"git ls-files\" has been moved from it starts with\n\n     coccinelle_opt = get_option('coccinelle').require(\n       fs.exists(meson.project_source_root() / '.git'),\n       error_message: 'coccinelle can only be run from a git checkout',\n     )\n\nI think it is probably fine to skip checking our headers and running \ncoccinelle when we don't have a git repository but we should ensure the \nmeson build can still be configured in that case by skipping those \ntargets. The Makefile falls back to using \"find\" if \"git ls-files\" fails \nwhich is another option.\n\nBest Wishes\n\nPhillip\n\n"},{"id":"516442","messageId":"CAOLa=ZSa-qQzi3iWPF+M5a4EsvGiQFX=2Ca=vzuqwSLWWXSw+g@mail.gmail.com","threadId":"63271","inReplyTo":"xmqq8qnt7c9w.fsf@gitster.g","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-21T20:08:46Z","receivedAt":"2025-04-21T20:08:48Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n>\n>> \"git ls-files\" is complaining that there isn't a git\n>> repository. Looking at the output of the checkout action (reproduced\n>> below) it appears it is extracting a tarball rather than using \"git\n>> clone\" because git is not available. I don't know what the best way to\n>> fix that is - I guess we could run \"apt-get install git\" before\n>> calling the checkout action.\n>\n> Interesting.  The use of actions/checkout@v4 is nothing new in\n> Karthik's series and we haven't seen this issue come up.  What's so\n> different with this particular series, I have to wonder...\n>\n\nSo the steps in the GitHub CI are:\n\n  ...\n  - uses: actions/checkout@v4 #1\n  - run: ci/install-dependencies.sh #2\n  ...\n  - run: sudo --preserve-env --set-home --user=builder\nci/run-build-and-tests.sh #3\n  ...\n\nStep #1, clones the repository, since the `git` executable isn't present\nat this step, it uses GitHub's REST API to obtain a tar of the\nrepository.\n\nStep #2, installs all dependencies, which includes the `git` executable.\n\nStep #3, sets up the build, which includes setting up meson in the meson\njob. At this point the `git` executable is present, so within meson\n`git.found()` would be true. As such we run 'git ls-files' as part of my\npatch series, but since the repository doesn't contain the `.git`\nfolder, the command fails.\n\nSo like Phillip mentioned, we need to ensure that the `git` executable\nis present before step #1.\n\nI hope that makes sense.\n\n> Thanks.\n"},{"id":"516444","messageId":"xmqqplh55ju3.fsf@gitster.g","threadId":"63271","inReplyTo":"3389d086-4e6e-4896-94dd-9f62d7c4f2df@gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-21T20:40:52Z","receivedAt":"2025-04-21T20:40:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> On 21/04/2025 16:41, Junio C Hamano wrote:\n>> Phillip Wood <phillip.wood123@gmail.com> writes:\n>> \n>>> \"git ls-files\" is complaining that there isn't a git\n>>> repository. Looking at the output of the checkout action (reproduced\n>>> below) it appears it is extracting a tarball rather than using \"git\n>>> clone\" because git is not available. I don't know what the best way to\n>>> fix that is - I guess we could run \"apt-get install git\" before\n>>> calling the checkout action.\n>> Interesting.  The use of actions/checkout@v4 is nothing new in\n>> Karthik's series and we haven't seen this issue come up.  What's so\n>> different with this particular series, I have to wonder...\n>\n> Good Question. Looking at contrib/coccinelle/meson.build which is\n> where the invocation of \"git ls-files\" has been moved from it starts\n> with\n>\n>     coccinelle_opt = get_option('coccinelle').require(\n>       fs.exists(meson.project_source_root() / '.git'),\n>       error_message: 'coccinelle can only be run from a git checkout',\n>     )\n>\n> I think it is probably fine to skip checking our headers and running\n> coccinelle when we don't have a git repository but we should ensure\n> the meson build can still be configured in that case by skipping those\n> targets. The Makefile falls back to using \"find\" if \"git ls-files\"\n> fails which is another option.\n\nYuck.  I somehow thought that CI jobs are always using a git\ncheckout, not tarball extract (after all, that is what\nactions/checkout implies to me X-<).  Of course it is good to\nautomatically ensure that our tarball extracts are buildable, but\nthe way tarballs are built upon release is probably different from\nhow these tarballs are made automatically (*), so in that sense not\nbuilding from a repository but building from \"git archive\" extract\nis not doing anybody a service.\n\n\n[Footnote]\n\n * \"make dist\" is how a release tarball is built for this project,\n   not \"git archive dist.tar HEAD\".\n\n"},{"id":"516446","messageId":"xmqqldrt5bto.fsf@gitster.g","threadId":"63271","inReplyTo":"CAOLa=ZSa-qQzi3iWPF+M5a4EsvGiQFX=2Ca=vzuqwSLWWXSw+g@mail.gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-21T23:33:55Z","receivedAt":"2025-04-21T23:33:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> Step #1, clones the repository, since the `git` executable isn't present\n> at this step, it uses GitHub's REST API to obtain a tar of the\n> repository.\n>\n> Step #2, installs all dependencies, which includes the `git` executable.\n>\n> Step #3, sets up the build, which includes setting up meson in the meson\n> job. At this point the `git` executable is present, so within meson\n> `git.found()` would be true. As such we run 'git ls-files' as part of my\n> patch series, but since the repository doesn't contain the `.git`\n> folder, the command fails.\n>\n> So like Phillip mentioned, we need to ensure that the `git` executable\n> is present before step #1.\n>\n> I hope that makes sense.\n\nPlease roll that into the appropriate commit log message for the fix\nyou'd send out, so the next person who wonders why this topic broke\nthe CI does not have to ask the same question.\n\nWould it make sense to just swap the order, then?  Our sources are\nmeant to be buildable from either release tarballs (which is created\nby \"make dist\") or a repository (with .git), but from the analysis\nof Phillip and you, it sounds like the CI environment has been\nbuilding and testing from a \"git archive HEAD\" output extracted as a\ntarball, which is *not* something any real users build from.  Making\nsure that building from release tarballs works is a good thing to\nensure in CI, because all our developers are testing in their own\nrepository (with .git) so we wouldn't easily notice ourselves if we\nbroke the build procedure in such a way that it would somehow\nrequire say \"git describe\" or \"git ls-files\" to work.\n\nThanks.\n\n\n"},{"id":"516462","messageId":"aAc92C53K2y-ijxA@pks.im","threadId":"63271","inReplyTo":"3389d086-4e6e-4896-94dd-9f62d7c4f2df@gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-04-22T06:57:28Z","receivedAt":"2025-04-22T06:57:33Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Mon, Apr 21, 2025 at 07:54:16PM +0100, Phillip Wood wrote:\n> \n> \n> On 21/04/2025 16:41, Junio C Hamano wrote:\n> > Phillip Wood <phillip.wood123@gmail.com> writes:\n> > \n> > > \"git ls-files\" is complaining that there isn't a git\n> > > repository. Looking at the output of the checkout action (reproduced\n> > > below) it appears it is extracting a tarball rather than using \"git\n> > > clone\" because git is not available. I don't know what the best way to\n> > > fix that is - I guess we could run \"apt-get install git\" before\n> > > calling the checkout action.\n> > \n> > Interesting.  The use of actions/checkout@v4 is nothing new in\n> > Karthik's series and we haven't seen this issue come up.  What's so\n> > different with this particular series, I have to wonder...\n> \n> Good Question. Looking at contrib/coccinelle/meson.build which is where the\n> invocation of \"git ls-files\" has been moved from it starts with\n> \n>     coccinelle_opt = get_option('coccinelle').require(\n>       fs.exists(meson.project_source_root() / '.git'),\n>       error_message: 'coccinelle can only be run from a git checkout',\n>     )\n> \n> I think it is probably fine to skip checking our headers and running\n> coccinelle when we don't have a git repository but we should ensure the\n> meson build can still be configured in that case by skipping those targets.\n\nAgreed. We should from my perspective just disable those targets when\nwe either don't have Git or when the source tree is not a Git directory.\n\n> The Makefile falls back to using \"find\" if \"git ls-files\" fails which is\n> another option.\n\nWe could do that, but I wonder whether it's really worth the additional\ncomplexity this introduces. I would expect that almost all users of\nthose targets would always have a Git repository available anyway. It is\nvery likely that for example a distributor of Git would run\n\"check-headers\" or \"coccicheck\".\n\nOur CI is a bit of an outlier here, but that should be a comparatively\neasy fix, I assume.\n\nPatrick\n"},{"id":"516486","messageId":"CAOLa=ZSSdp4KBHAviudJm=H+bP0aqru=LN2=4hsYsqyM7zLMgw@mail.gmail.com","threadId":"63271","inReplyTo":"xmqqldrt5bto.fsf@gitster.g","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-22T09:11:04Z","receivedAt":"2025-04-22T09:11:06Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Karthik Nayak <karthik.188@gmail.com> writes:\n>\n>> Step #1, clones the repository, since the `git` executable isn't present\n>> at this step, it uses GitHub's REST API to obtain a tar of the\n>> repository.\n>>\n>> Step #2, installs all dependencies, which includes the `git` executable.\n>>\n>> Step #3, sets up the build, which includes setting up meson in the meson\n>> job. At this point the `git` executable is present, so within meson\n>> `git.found()` would be true. As such we run 'git ls-files' as part of my\n>> patch series, but since the repository doesn't contain the `.git`\n>> folder, the command fails.\n>>\n>> So like Phillip mentioned, we need to ensure that the `git` executable\n>> is present before step #1.\n>>\n>> I hope that makes sense.\n>\n> Please roll that into the appropriate commit log message for the fix\n> you'd send out, so the next person who wonders why this topic broke\n> the CI does not have to ask the same question.\n>\n\nYeah, will do!\n\n> Would it make sense to just swap the order, then?\n\nUnfortunately not, this is a chicken-egg problem. The dependencies are\ninstalled by 'ci/install-dependencies.sh', which are not present until\nthe source is available.\n\n> Our sources are\n> meant to be buildable from either release tarballs (which is created\n> by \"make dist\") or a repository (with .git), but from the analysis\n> of Phillip and you, it sounds like the CI environment has been\n> building and testing from a \"git archive HEAD\" output extracted as a\n> tarball, which is *not* something any real users build from.  Making\n> sure that building from release tarballs works is a good thing to\n> ensure in CI, because all our developers are testing in their own\n> repository (with .git) so we wouldn't easily notice ourselves if we\n> broke the build procedure in such a way that it would somehow\n> require say \"git describe\" or \"git ls-files\" to work.\n>\n\nAnother additional point is that this also means that the two CIs\n(GitLab and GitHub) now run builds differently, while it would be nice\nto have a separate job to test building on tarballs. I would say\ncurrently we should fix this to build on a Git repository.\n\n> Thanks.\n"},{"id":"516494","messageId":"17c2eb4f-e291-4189-9846-0f42bdead01d@gmail.com","threadId":"63271","inReplyTo":"CAOLa=ZSR=7TEWLHa-wzBB4x+4+-BH3UC3G7s24Bc26JH63QKOA@mail.gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-22T13:24:18Z","receivedAt":"2025-04-22T13:24:23Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Karthik\n\nOn 21/04/2025 16:33, Karthik Nayak wrote:\n\nThanks for putting this together, I've left a couple of code comments below.\n\n>      Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n> \n> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\n> index 37541f3d10..a09fcf4d72 100644\n> --- a/.github/workflows/main.yml\n> +++ b/.github/workflows/main.yml\n> @@ -414,6 +414,16 @@ jobs:\n>       - name: prepare libc6 for actions\n>         if: matrix.vector.jobname == 'linux32'\n>         run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6\n> +    - name: install git in container\n> +      run: |\n> +        if [ -f /etc/alpine-release ]; then\n> +          apk update && apk add --no-cache git\n> +        elif [ -f /etc/almalinux-release ] || [ -f /etc/redhat-release ]; then\n> +           dnf -y install git\n> +        else\n> +          apt -q update && apt -q -y install git\n> +        fi\n> +        git config --global --add safe.directory \"$GITHUB_WORKSPACE\"\n\nI'd be tempted to check for which package manager to use by using \n`command -v`. That way the only distribution specific knowledge we need \nis the package manager and we don't have to worry about the names of the \nvarious release files in /etc.\n\n\tif command -v git\n\tthen\n\t\t: nothing to do\n\telif command -v apk\n\tthen\n\t\tapk add git\n\telif command -v dnf\n\tthen\n\t\tdnf -y install git\n\telse\n\t\tapt-get -q -y install git\n\tfi\n\nThe commands above omit anything that updates the package cache as we do \nthat anyway in install-dependencies.sh and we only really care about \ngetting some version of git installed here. It also uses apt-get to \nmatch what we do in install-dependencies.sh\n\nI also wonder if we should ditch the checkout action and use something like\n\n     git clone --depth=1 --single-branch ${GITHUB_REF_NAME} \\\n\t${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git\n\nso that we know we will be building from a git repository.\n\nBest Wishes\n\nPhillip\n\n"},{"id":"516496","messageId":"CAOLa=ZRmwnjytxoqG0fJWXFjaZcGQ9g=PFmx9N5Thuq64C24GQ@mail.gmail.com","threadId":"63271","inReplyTo":"17c2eb4f-e291-4189-9846-0f42bdead01d@gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-22T14:10:29Z","receivedAt":"2025-04-22T14:10:32Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> Hi Karthik\n>\n> On 21/04/2025 16:33, Karthik Nayak wrote:\n>\n> Thanks for putting this together, I've left a couple of code comments below.\n>\n>>      Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>>\n>> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\n>> index 37541f3d10..a09fcf4d72 100644\n>> --- a/.github/workflows/main.yml\n>> +++ b/.github/workflows/main.yml\n>> @@ -414,6 +414,16 @@ jobs:\n>>       - name: prepare libc6 for actions\n>>         if: matrix.vector.jobname == 'linux32'\n>>         run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6\n>> +    - name: install git in container\n>> +      run: |\n>> +        if [ -f /etc/alpine-release ]; then\n>> +          apk update && apk add --no-cache git\n>> +        elif [ -f /etc/almalinux-release ] || [ -f /etc/redhat-release ]; then\n>> +           dnf -y install git\n>> +        else\n>> +          apt -q update && apt -q -y install git\n>> +        fi\n>> +        git config --global --add safe.directory \"$GITHUB_WORKSPACE\"\n>\n> I'd be tempted to check for which package manager to use by using\n> `command -v`. That way the only distribution specific knowledge we need\n> is the package manager and we don't have to worry about the names of the\n> various release files in /etc.\n>\n> \tif command -v git\n> \tthen\n> \t\t: nothing to do\n> \telif command -v apk\n> \tthen\n> \t\tapk add git\n> \telif command -v dnf\n> \tthen\n> \t\tdnf -y install git\n> \telse\n> \t\tapt-get -q -y install git\n> \tfi\n>\n> The commands above omit anything that updates the package cache as we do\n> that anyway in install-dependencies.sh and we only really care about\n> getting some version of git installed here. It also uses apt-get to\n> match what we do in install-dependencies.sh\n>\n\nYeah this makes sense, we don't have to worry about specific\ndistributions.\n\n> I also wonder if we should ditch the checkout action and use something like\n>\n>      git clone --depth=1 --single-branch ${GITHUB_REF_NAME} \\\n> \t${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git\n>\n> so that we know we will be building from a git repository.\n>\n\nPossibly, but I'll leave this out as I feel we're already straying from\nthe topic now. Let me know if you feel strongly about it.\n\n> Best Wishes\n>\n> Phillip\n"},{"id":"516513","messageId":"xmqqr01k42cx.fsf@gitster.g","threadId":"63271","inReplyTo":"17c2eb4f-e291-4189-9846-0f42bdead01d@gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-22T15:55:58Z","receivedAt":"2025-04-22T15:56:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> I'd be tempted to check for which package manager to use by using\n> `command -v`. That way the only distribution specific knowledge we\n> need is the package manager and we don't have to worry about the names\n> of the various release files in /etc.\n>\n> \tif command -v git\n> \tthen\n> \t\t: nothing to do\n> \telif command -v apk\n> \tthen\n> \t\tapk add git\n> \telif command -v dnf\n> \tthen\n> \t\tdnf -y install git\n> \telse\n> \t\tapt-get -q -y install git\n> \tfi\n\nOK.  \"command -v\" should be portable enough these days (in the past\npeople used \"type\" and yelled at by portability sherriff).  And\nhaving one command line per package manager should be simpler than\nhaving one command line per distro, provided if two distros that\nshare the same package manager name the \"git\" package the same way.\nWe had trouble with \"awk\" recently ;-)\n\nCurious that we do not check the availability of apt-get here (or\njust \"apt\").\n\n> The commands above omit anything that updates the package cache as we\n> do that anyway in install-dependencies.sh and we only really care\n> about getting some version of git installed here. It also uses apt-get\n> to match what we do in install-dependencies.sh\n\nOK.\n"},{"id":"516514","messageId":"xmqqmsc842bp.fsf@gitster.g","threadId":"63271","inReplyTo":"CAOLa=ZSSdp4KBHAviudJm=H+bP0aqru=LN2=4hsYsqyM7zLMgw@mail.gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-22T15:56:42Z","receivedAt":"2025-04-22T15:56:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n>> Would it make sense to just swap the order, then?\n>\n> Unfortunately not, this is a chicken-egg problem. The dependencies are\n> installed by 'ci/install-dependencies.sh', which are not present until\n> the source is available.\n\nAh, of course.  Thanks.\n"},{"id":"516524","messageId":"CAOLa=ZSi5FuhpaAiGn5OydLUXhkWC9VrkOvXKwTeP=9S2uhKgQ@mail.gmail.com","threadId":"63271","inReplyTo":"17c2eb4f-e291-4189-9846-0f42bdead01d@gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-22T18:56:10Z","receivedAt":"2025-04-22T18:56:12Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> Hi Karthik\n>\n> On 21/04/2025 16:33, Karthik Nayak wrote:\n>\n> Thanks for putting this together, I've left a couple of code comments below.\n>\n>>      Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>>\n>> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\n>> index 37541f3d10..a09fcf4d72 100644\n>> --- a/.github/workflows/main.yml\n>> +++ b/.github/workflows/main.yml\n>> @@ -414,6 +414,16 @@ jobs:\n>>       - name: prepare libc6 for actions\n>>         if: matrix.vector.jobname == 'linux32'\n>>         run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6\n>> +    - name: install git in container\n>> +      run: |\n>> +        if [ -f /etc/alpine-release ]; then\n>> +          apk update && apk add --no-cache git\n>> +        elif [ -f /etc/almalinux-release ] || [ -f /etc/redhat-release ]; then\n>> +           dnf -y install git\n>> +        else\n>> +          apt -q update && apt -q -y install git\n>> +        fi\n>> +        git config --global --add safe.directory \"$GITHUB_WORKSPACE\"\n>\n> I'd be tempted to check for which package manager to use by using\n> `command -v`. That way the only distribution specific knowledge we need\n> is the package manager and we don't have to worry about the names of the\n> various release files in /etc.\n>\n> \tif command -v git\n> \tthen\n> \t\t: nothing to do\n> \telif command -v apk\n> \tthen\n> \t\tapk add git\n> \telif command -v dnf\n> \tthen\n> \t\tdnf -y install git\n> \telse\n> \t\tapt-get -q -y install git\n> \tfi\n>\n> The commands above omit anything that updates the package cache as we do\n> that anyway in install-dependencies.sh and we only really care about\n> getting some version of git installed here. It also uses apt-get to\n> match what we do in install-dependencies.sh\n>\n\nSeems like this is a no-go, since apt-get fails [1] without first\nupdating the package cache. So I'm going to do that for all the\ncommands, which should also ensure that the package cache update in\n'install-dependencies.sh' is mostly a no-op.\n\n[1]: https://github.com/gitgitgadget/git/actions/runs/14598683520/job/40951070359?pr=1905\n\n> I also wonder if we should ditch the checkout action and use something like\n>\n>      git clone --depth=1 --single-branch ${GITHUB_REF_NAME} \\\n> \t${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git\n>\n> so that we know we will be building from a git repository.\n>\n> Best Wishes\n>\n> Phillip\n"},{"id":"516548","messageId":"ddfbd943-73e0-4ca2-a458-26b05750ed9f@gentoo.org","threadId":"63271","inReplyTo":"xmqqr01k42cx.fsf@gitster.g","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Eli Schwartz","fromEmail":"eschwartz@gentoo.org","sentAt":"2025-04-23T01:17:34Z","receivedAt":"2025-04-23T01:17:38Z","isPatch":true,"sender":{"key":"eschwartz@gentoo.org","avatar":"https://avatars.githubusercontent.com/u/6551424?v=4"},"body":"On 4/22/25 11:55 AM, Junio C Hamano wrote:\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n> \n>> I'd be tempted to check for which package manager to use by using\n>> `command -v`. That way the only distribution specific knowledge we\n>> need is the package manager and we don't have to worry about the names\n>> of the various release files in /etc.\n>>\n>> \tif command -v git\n>> \tthen\n>> \t\t: nothing to do\n>> \telif command -v apk\n>> \tthen\n>> \t\tapk add git\n>> \telif command -v dnf\n>> \tthen\n>> \t\tdnf -y install git\n>> \telse\n>> \t\tapt-get -q -y install git\n>> \tfi\n> \n> OK.  \"command -v\" should be portable enough these days (in the past\n> people used \"type\" and yelled at by portability sherriff). \n\n\nIt (command -v) is available since POSIX 2008, yes. Optional before\nthat, and thus available in many (but not all) contexts.\n\nDebian upgraded from POSIX 2001 to POSIX 2008, as of July 2018, see\nhttps://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864615\n\nQuotable quote:\n\n\"\"\"\nThis version of the standard is so outdated that it isn't even any\nlonger available on the opengroup web site. [...] Please consider\nupdating the policy.\n\"\"\"\n\n\n-- \nEli Schwartz\n"},{"id":"516578","messageId":"20250423-505-wire-up-sparse-via-meson-v5-0-d1e2be4b2078@gmail.com","threadId":"63271","inReplyTo":"20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com","subject":"[PATCH v5 0/6] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T08:15:33Z","receivedAt":"2025-04-23T08:15:40Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"To bridge the remaining gaps between Makefile and Meson, this patch\nseries adds 'hdr-check' to Meson to compliment the Makefile's\n'hdr-check'.\n\nWe also introduce 'headers-check' as an alias to 'hdr-check' as a better\nnamed replacement in both Meson and make and add a note to deprecate\n'hdr-check' in the future.\n\nThe first two commits are small cleanups, where we re-organize existing\nvariables to make it easier to add the target. The third commit adds the\n'hdr-check' target to Meson. The last commit introduces the\n'headers-check' alias to both Meson and the makefile and marks\n'hdr-check' to be deprecated.\n\nThis is based on master 9d22ac5122 (The third batch, 2025-04-07) with\n'es/meson-build-skip-coccinelle' merged in.\n\n---\nChanges in v5:\n- Add a commit to install 'git' in GitHub's CI before the repository is\n  checked out. Without the presence of the 'git' executable, GitHub\n  downloads a tar of the repo instead of cloning it. This causes the\n  patch series to fail in CI.\n- Expose the 'headers_to_check' variable even if 'git' executable is not\n  found or not a repository. This ensures dependencies of\n  'headers_to_check' can simply rely on its length. We also check that\n  the '.git' folder is setup before populating 'headers_to_check', this\n  ensures Meson doesn't fail in tarball of the Git source code.\n- Link to v4: https://lore.kernel.org/r/20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com\n\nChanges in v4:\n- Rename headers to headers_to_check, since these headers are only used\n  for static analysis.\n- Added a commit to rename third_party_sources -> third_party_excludes\n  and remove a duplicate.\n- Fix a typo 'gcrpyt' -> 'gcrypt'\n- Remove 'generated_headers', since we use 'git ls-files' and that would\n  already ignore files within '.gitignore'.\n- Link to v3: https://lore.kernel.org/r/20250414-505-wire-up-sparse-via-meson-v3-0-edc6e7f26745@gmail.com\n\nChanges in v3:\n- Some renames:\n  - headers_generated -> generated_headers\n  - meson -> Meson\n  - headers-check -> check-headers\n  - headers_check_exclude -> exclude_from_check_headers\n- Rewrite 'headers_check_exclude' to also contain dirs so we can skip\n  listing individual header files.\n- Move 'xdiff/*' to 'third_party_sources' and cleanup\n  'exclude_from_check_headers'.\n- Use 'echo' instead of 'echo -n'.\n- Use `fs.replace_suffix` instead of `str.replace`.\n- Link to v2: https://lore.kernel.org/r/20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com\n\nChanges in v2:\n- Add 'hdr-check' to meson, while introducing 'headers-check' as\n  a replacement alias. Schedule 'hdr-check' to be deprecated in the future.\n- Link to v1: https://lore.kernel.org/r/20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com\n\n---\n .github/workflows/main.yml     | 14 +++++++\n Makefile                       |  4 +-\n ci/run-static-analysis.sh      |  2 +-\n contrib/coccinelle/meson.build | 31 ++++-----------\n meson.build                    | 86 ++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 112 insertions(+), 25 deletions(-)\n\nKarthik Nayak (6):\n      ci/github: install git before checking out the repository\n      coccinelle: meson: rename variables to be more specific\n      meson: move headers definition from 'contrib/coccinelle'\n      meson: rename 'third_party_sources' to 'third_party_excludes'\n      meson: add support for 'hdr-check'\n      makefile/meson: add 'check-headers' as alias for 'hdr-check'\n\nRange-diff versus v4:\n\n-:  ---------- > 1:  d20993a59e ci/github: install git before checking out the repository\n1:  0f1160fa78 = 2:  6eb10dd3b1 coccinelle: meson: rename variables to be more specific\n2:  933b199def ! 3:  7950b44c6f meson: move headers definition from 'contrib/coccinelle'\n    @@ Commit message\n         makes it easier to understand as the variable is now propagated from the\n         top level to the bottom.\n     \n    +    While 'headers_to_check' is only computed when we have a repository and\n    +    the 'git' executable is present, the variable itself is exposed as an\n    +    empty array. This allows dependencies in upcoming commits to simply\n    +    check for length of the array and not worry about dependencies required\n    +    to actually populate the array.\n    +\n         Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n     \n      ## contrib/coccinelle/meson.build ##\n    @@ meson.build: builtin_sources = [\n     +  ':!t/t[0-9][0-9][0-9][0-9]*',\n     +]\n     +\n    -+if git.found()\n    -+  headers_to_check = []\n    ++headers_to_check = []\n    ++if git.found() and fs.exists(meson.project_source_root() / '.git')\n     +  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n     +    headers_to_check += header\n     +  endforeach\n3:  ab04192864 ! 4:  7fd64b788b meson: rename 'third_party_sources' to 'third_party_excludes'\n    @@ meson.build: third_party_sources = [\n        ':!t/t[0-9][0-9][0-9][0-9]*',\n      ]\n      \n    - if git.found()\n    -   headers_to_check = []\n    + headers_to_check = []\n    + if git.found() and fs.exists(meson.project_source_root() / '.git')\n     -  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n     +  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_excludes, check: true).stdout().split()\n          headers_to_check += header\n4:  69a4b5abc9 ! 5:  df0472be57 meson: add support for 'hdr-check'\n    @@ meson.build: third_party_excludes = [\n     +  ':!xdiff',\n      ]\n      \n    - if git.found()\n    + headers_to_check = []\n     @@ meson.build: endif\n      \n      subdir('contrib')\n    @@ meson.build: endif\n     +  exclude_from_check_headers += 'sha256/gcrypt.h'\n     +endif\n     +\n    -+if git.found() and compiler.get_argument_syntax() == 'gcc'\n    ++if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n     +  hco_targets = []\n     +  foreach h : headers_to_check\n     +    skip_header = false\n5:  a0c799cf8c ! 6:  7d9a33767b makefile/meson: add 'check-headers' as alias for 'hdr-check'\n    @@ ci/run-static-analysis.sh: then\n      make check-pot\n     \n      ## meson.build ##\n    -@@ meson.build: if git.found() and compiler.get_argument_syntax() == 'gcc'\n    +@@ meson.build: if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n          hco_targets += hco\n        endforeach\n      \n\n\nbase-commit: 3a956c5f69873611ae5f8dcb9acd117f66b95ddc\nchange-id: 20250330-505-wire-up-sparse-via-meson-2e32dd31208b\n\nThanks\n- Karthik\n\n"},{"id":"516579","messageId":"20250423-505-wire-up-sparse-via-meson-v5-1-d1e2be4b2078@gmail.com","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-0-d1e2be4b2078@gmail.com","subject":"[PATCH v5 1/6] ci/github: install git before checking out the repository","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T08:15:34Z","receivedAt":"2025-04-23T08:15:40Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The GitHub's CI workflow uses 'actions/checkout@v4' to checkout the\nrepository. This action defaults to using the GitHub REST API to obtain\nthe repository if the `git` executable isn't available.\n\nThe step to build Git in the GitHub workflow can be summarized as:\n\n  ...\n  - uses: actions/checkout@v4 #1\n  - run: ci/install-dependencies.sh #2\n  ...\n  - run: sudo --preserve-env --set-home --user=builder ci/run-build-and-tests.sh #3\n  ...\n\nStep #1, clones the repository, since the `git` executable isn't present\nat this step, it uses GitHub's REST API to obtain a tar of the\nrepository.\n\nStep #2, installs all dependencies, which includes the `git` executable.\n\nStep #3, sets up the build, which includes setting up meson in the meson\njob. At this point the `git` executable is present.\n\nThis means while the `git` executable is present, the repository doesn't\ncontain the '.git' folder. To keep both the CI's (GitLab and GitHub)\nbehavior consistent and to ensure that the build is performed on a\nreal-world scenario, install `git` before the repository is checked out.\nThis ensures that 'actions/checkout@v4' will clone the repository\ninstead of using a tarball. We also update the package cache while\ninstalling `git`, this is because some distros will fail to locate the\npackage without updating the cache.\n\nHelped-by: Phillip Wood <phillip.wood123@gmail.com>\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n .github/workflows/main.yml | 14 ++++++++++++++\n 1 file changed, 14 insertions(+)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 37541f3d10..e9112b3a64 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -414,6 +414,20 @@ jobs:\n     - name: prepare libc6 for actions\n       if: matrix.vector.jobname == 'linux32'\n       run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6\n+    - name: install git in container\n+      run: |\n+        if command -v git\n+        then\n+          : # nothing to do\n+        elif command -v apk\n+        then\n+          apk add --update git\n+        elif command -v dnf\n+        then\n+          dnf -yq update && dnf -yq install git\n+        else\n+          apt-get -q update && apt-get -q -y install git\n+        fi\n     - uses: actions/checkout@v4\n     - run: ci/install-dependencies.sh\n     - run: useradd builder --create-home\n\n-- \n2.48.1\n\n"},{"id":"516580","messageId":"20250423-505-wire-up-sparse-via-meson-v5-2-d1e2be4b2078@gmail.com","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-0-d1e2be4b2078@gmail.com","subject":"[PATCH v5 2/6] coccinelle: meson: rename variables to be more specific","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T08:15:35Z","receivedAt":"2025-04-23T08:15:41Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"In Meson, included subdirs export their variables to top level Meson\nbuilds. In 'contrib/coccinelle/meson.build', we define two such\nvariables `sources` and `headers`. While these variables are specific to\nthe checks in the 'contrib/coccinelle/' directory, they also pollute the\ntop level 'meson.build'.\n\nRename them to be more specific, this ensures that they aren't\nmistakenly used in the upper levels and avoid variable name collisions.\n\nWhile here, change the empty list denotation to be consistent with other\nplaces.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex ea054c924f..03ce52d752 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -55,18 +55,18 @@ concatenated_rules = custom_target(\n   capture: true,\n )\n \n-sources = [ ]\n+coccinelle_sources = []\n foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()\n-  sources += source\n+  coccinelle_sources += source\n endforeach\n \n-headers = [ ]\n+coccinelle_headers = []\n foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n-  headers += meson.project_source_root() / header\n+  coccinelle_headers += meson.project_source_root() / header\n endforeach\n \n patches = [ ]\n-foreach source : sources\n+foreach source : coccinelle_sources\n   patches += custom_target(\n     command: [\n       spatch,\n@@ -78,7 +78,7 @@ foreach source : sources\n     input: meson.project_source_root() / source,\n     output: source.underscorify() + '.patch',\n     capture: true,\n-    depend_files: headers,\n+    depend_files: coccinelle_headers,\n   )\n endforeach\n \n\n-- \n2.48.1\n\n"},{"id":"516581","messageId":"20250423-505-wire-up-sparse-via-meson-v5-3-d1e2be4b2078@gmail.com","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-0-d1e2be4b2078@gmail.com","subject":"[PATCH v5 3/6] meson: move headers definition from 'contrib/coccinelle'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T08:15:36Z","receivedAt":"2025-04-23T08:15:42Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The Meson build for coccinelle static analysis lists all headers to\nanalyse. Due to the way Meson exports variables between subdirs, this\nvariable is also available in the root Meson build.\n\nAn upcoming commit, will add a new check complimenting 'hdr-check' in\nthe Makefile. This would require the list of headers. So move the\n'coccinelle_headers' to the root Meson build and rename it to 'headers',\nremove the root path being appended to each header and retain that in\nthe coccinelle Meson build since it is specific to the coccinelle build.\n\nAlso move the 'third_party_sources' variable to the root Meson build\nsince it is also a dependency for the 'headers' variable. This also\nmakes it easier to understand as the variable is now propagated from the\ntop level to the bottom.\n\nWhile 'headers_to_check' is only computed when we have a repository and\nthe 'git' executable is present, the variable itself is exposed as an\nempty array. This allows dependencies in upcoming commits to simply\ncheck for length of the array and not worry about dependencies required\nto actually populate the array.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 17 +----------------\n meson.build                    | 22 ++++++++++++++++++++++\n 2 files changed, 23 insertions(+), 16 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex 03ce52d752..4f07824402 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -8,21 +8,6 @@ if not spatch.found()\n   subdir_done()\n endif\n \n-third_party_sources = [\n-  ':!contrib',\n-  ':!compat/inet_ntop.c',\n-  ':!compat/inet_pton.c',\n-  ':!compat/nedmalloc',\n-  ':!compat/obstack.*',\n-  ':!compat/poll',\n-  ':!compat/regex',\n-  ':!sha1collisiondetection',\n-  ':!sha1dc',\n-  ':!t/unit-tests/clar',\n-  ':!t/unit-tests/clar',\n-  ':!t/t[0-9][0-9][0-9][0-9]*',\n-]\n-\n rules = [\n   'array.cocci',\n   'commit.cocci',\n@@ -61,7 +46,7 @@ foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files',\n endforeach\n \n coccinelle_headers = []\n-foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+foreach header : headers_to_check\n   coccinelle_headers += meson.project_source_root() / header\n endforeach\n \ndiff --git a/meson.build b/meson.build\nindex e98cfa4909..e147ddff28 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -633,6 +633,28 @@ builtin_sources = [\n   'builtin/write-tree.c',\n ]\n \n+third_party_sources = [\n+  ':!contrib',\n+  ':!compat/inet_ntop.c',\n+  ':!compat/inet_pton.c',\n+  ':!compat/nedmalloc',\n+  ':!compat/obstack.*',\n+  ':!compat/poll',\n+  ':!compat/regex',\n+  ':!sha1collisiondetection',\n+  ':!sha1dc',\n+  ':!t/unit-tests/clar',\n+  ':!t/unit-tests/clar',\n+  ':!t/t[0-9][0-9][0-9][0-9]*',\n+]\n+\n+headers_to_check = []\n+if git.found() and fs.exists(meson.project_source_root() / '.git')\n+  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+    headers_to_check += header\n+  endforeach\n+endif\n+\n if not get_option('breaking_changes')\n   builtin_sources += 'builtin/pack-redundant.c'\n endif\n\n-- \n2.48.1\n\n"},{"id":"516582","messageId":"20250423-505-wire-up-sparse-via-meson-v5-4-d1e2be4b2078@gmail.com","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-0-d1e2be4b2078@gmail.com","subject":"[PATCH v5 4/6] meson: rename 'third_party_sources' to 'third_party_excludes'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T08:15:37Z","receivedAt":"2025-04-23T08:15:43Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 'third_party_sources' variable was moved to the root 'meson.build'\nfile in the previous commit. The variable is actually used to exclude\nthird party sources, so rename it accordingly to 'third_party_excludes'\nto avoid confusion. While here, remove a duplicate from the list.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n contrib/coccinelle/meson.build | 2 +-\n meson.build                    | 5 ++---\n 2 files changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build\nindex 4f07824402..dc3f73c2e7 100644\n--- a/contrib/coccinelle/meson.build\n+++ b/contrib/coccinelle/meson.build\n@@ -41,7 +41,7 @@ concatenated_rules = custom_target(\n )\n \n coccinelle_sources = []\n-foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()\n+foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_excludes, check: true).stdout().split()\n   coccinelle_sources += source\n endforeach\n \ndiff --git a/meson.build b/meson.build\nindex e147ddff28..4618804c7a 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -633,7 +633,7 @@ builtin_sources = [\n   'builtin/write-tree.c',\n ]\n \n-third_party_sources = [\n+third_party_excludes = [\n   ':!contrib',\n   ':!compat/inet_ntop.c',\n   ':!compat/inet_pton.c',\n@@ -644,13 +644,12 @@ third_party_sources = [\n   ':!sha1collisiondetection',\n   ':!sha1dc',\n   ':!t/unit-tests/clar',\n-  ':!t/unit-tests/clar',\n   ':!t/t[0-9][0-9][0-9][0-9]*',\n ]\n \n headers_to_check = []\n if git.found() and fs.exists(meson.project_source_root() / '.git')\n-  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n+  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_excludes, check: true).stdout().split()\n     headers_to_check += header\n   endforeach\n endif\n\n-- \n2.48.1\n\n"},{"id":"516583","messageId":"20250423-505-wire-up-sparse-via-meson-v5-5-d1e2be4b2078@gmail.com","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-0-d1e2be4b2078@gmail.com","subject":"[PATCH v5 5/6] meson: add support for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T08:15:38Z","receivedAt":"2025-04-23T08:15:44Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The Makefile supports a target called 'hdr-check', which checks if\nindividual header files can be independently compiled. Let's port this\nfunctionality to Meson, our new build system too. The implementation\nresembles that of the Makefile and provides the same check.\n\nSince meson builds are out-of-tree, header dependencies are not\nautomatically met. So unlike the Makefile version, we also need to add\nthe required dependencies.\n\nAlso add the 'xdiff/' dir to the list of 'third_party_sources' as those\nheaders must be skipped from the checks too. This also skips the folder\nfrom the 'coccinelle' checks, this is okay, since this code is an\nexternal dependency.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n meson.build | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 63 insertions(+)\n\ndiff --git a/meson.build b/meson.build\nindex 4618804c7a..22fc65ec80 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -645,6 +645,7 @@ third_party_excludes = [\n   ':!sha1dc',\n   ':!t/unit-tests/clar',\n   ':!t/t[0-9][0-9][0-9][0-9]*',\n+  ':!xdiff',\n ]\n \n headers_to_check = []\n@@ -1994,6 +1995,68 @@ endif\n \n subdir('contrib')\n \n+exclude_from_check_headers = [\n+  'compat/',\n+  'unicode-width.h',\n+]\n+\n+if sha1_backend != 'openssl'\n+  exclude_from_check_headers += 'sha1/openssl.h'\n+endif\n+if sha256_backend != 'openssl'\n+  exclude_from_check_headers += 'sha256/openssl.h'\n+endif\n+if sha256_backend != 'nettle'\n+  exclude_from_check_headers += 'sha256/nettle.h'\n+endif\n+if sha256_backend != 'gcrypt'\n+  exclude_from_check_headers += 'sha256/gcrypt.h'\n+endif\n+\n+if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n+  hco_targets = []\n+  foreach h : headers_to_check\n+    skip_header = false\n+    foreach exclude : exclude_from_check_headers\n+      if h.startswith(exclude)\n+        skip_header = true\n+        break\n+      endif\n+    endforeach\n+\n+    if skip_header\n+      continue\n+    endif\n+\n+    hcc = custom_target(\n+      input: h,\n+      output: h.underscorify() + 'cc',\n+      command: [\n+        shell,\n+        '-c',\n+        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n+      ]\n+    )\n+\n+    hco = custom_target(\n+      input: hcc,\n+      output: fs.replace_suffix(h.underscorify(), '.hco'),\n+      command: [\n+        compiler.cmd_array(),\n+        libgit_c_args,\n+        '-I', meson.project_source_root(),\n+        '-I', meson.project_source_root() / 't/unit-tests',\n+        '-o', '/dev/null',\n+        '-c', '-xc',\n+        '@INPUT@'\n+      ]\n+    )\n+    hco_targets += hco\n+  endforeach\n+\n+  alias_target('hdr-check', hco_targets)\n+endif\n+\n foreach key, value : {\n   'DIFF': diff.full_path(),\n   'GIT_SOURCE_DIR': meson.project_source_root(),\n\n-- \n2.48.1\n\n"},{"id":"516584","messageId":"20250423-505-wire-up-sparse-via-meson-v5-6-d1e2be4b2078@gmail.com","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-0-d1e2be4b2078@gmail.com","subject":"[PATCH v5 6/6] makefile/meson: add 'check-headers' as alias for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T08:15:39Z","receivedAt":"2025-04-23T08:15:45Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"The 'hdr-check' target in Meson and makefile is used to check if headers\ncan be compiled individually. The naming however isn't readable as 'hdr'\nis not a common shortforme for 'header', neither is it an abbreviation.\n\nLet's introduce 'check-headers' as an alternative target for 'hdr-check'\nand add a `TODO` to deprecate the latter after 2 releases. Since this\nis an internal tool, we can use a shorter deprecation cycle.\n\nChange existing usage of 'hdr-check' in 'ci/run-static-analysis.sh' to\nalso use 'check-headers'.\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n Makefile                  | 4 +++-\n ci/run-static-analysis.sh | 2 +-\n meson.build               | 4 +++-\n 3 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex ac32d2d0bd..961ee508be 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3326,8 +3326,10 @@ HCC = $(HCO:hco=hcc)\n $(HCO): %.hco: %.hcc $(GENERATED_H) FORCE\n \t$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<\n \n-.PHONY: hdr-check $(HCO)\n+# TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+\n+.PHONY: hdr-check check-headers $(HCO)\n hdr-check: $(HCO)\n+check-headers: hdr-check\n \n .PHONY: style\n style:\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 0d51e5ce0e..60c175a094 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -26,7 +26,7 @@ then\n \texit 1\n fi\n \n-make hdr-check ||\n+make check-headers ||\n exit 1\n \n make check-pot\ndiff --git a/meson.build b/meson.build\nindex 22fc65ec80..569e3888fb 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -2054,7 +2054,9 @@ if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n     hco_targets += hco\n   endforeach\n \n-  alias_target('hdr-check', hco_targets)\n+  # TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+\n+  hdr_check = alias_target('hdr-check', hco_targets)\n+  alias_target('check-headers', hdr_check)\n endif\n \n foreach key, value : {\n\n-- \n2.48.1\n\n"},{"id":"516586","messageId":"1996b081-2684-49e0-a99d-28f22063b4b6@gmail.com","threadId":"63271","inReplyTo":"xmqqplh55ju3.fsf@gitster.g","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-23T10:04:37Z","receivedAt":"2025-04-23T10:04:40Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 21/04/2025 21:40, Junio C Hamano wrote:\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n> \n> Yuck.  I somehow thought that CI jobs are always using a git\n> checkout, not tarball extract (after all, that is what\n> actions/checkout implies to me X-<). \n\nThat's what I'd assumed as well, I was quite surprised when I realized \nthe \"checkout\" action was actually unpacking a tarball\n\nBest Wishes\n\nPhillip\n\n> Of course it is good to\n> automatically ensure that our tarball extracts are buildable, but\n> the way tarballs are built upon release is probably different from\n> how these tarballs are made automatically (*), so in that sense not\n> building from a repository but building from \"git archive\" extract\n> is not doing anybody a service.\n> \n> \n> [Footnote]\n> \n>   * \"make dist\" is how a release tarball is built for this project,\n>     not \"git archive dist.tar HEAD\".\n> \n\n"},{"id":"516587","messageId":"895a796e-86ab-4b9f-b480-ca749312601f@gmail.com","threadId":"63271","inReplyTo":"xmqqr01k42cx.fsf@gitster.g","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-23T10:04:48Z","receivedAt":"2025-04-23T10:04:51Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 22/04/2025 16:55, Junio C Hamano wrote:\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n> \n>> I'd be tempted to check for which package manager to use by using\n>> `command -v`. That way the only distribution specific knowledge we\n>> need is the package manager and we don't have to worry about the names\n>> of the various release files in /etc.\n>>\n>> \tif command -v git\n>> \tthen\n>> \t\t: nothing to do\n>> \telif command -v apk\n>> \tthen\n>> \t\tapk add git\n>> \telif command -v dnf\n>> \tthen\n>> \t\tdnf -y install git\n>> \telse\n>> \t\tapt-get -q -y install git\n>> \tfi\n> \n> OK.  \"command -v\" should be portable enough these days (in the past\n> people used \"type\" and yelled at by portability sherriff).  And\n> having one command line per package manager should be simpler than\n> having one command line per distro, provided if two distros that\n> share the same package manager name the \"git\" package the same way.\n> We had trouble with \"awk\" recently ;-)\n\nOh, I'd not thought that different distributions might have different \npackage names for git. We already have a few uses of \"command -v\" in our \ntests and ci scripts so I don't think using it here should be an issue.\n\n> Curious that we do not check the availability of apt-get here (or\n> just \"apt\").\nIt is a lazy way of erroring out if we add a new image that uses a \ndifferent package manager to the matrix and forget to update the list \nhere. We could instead check for apt-get and add an else clause that \nprints a proper message.\n\nBest Wishes\n\nPhillip\n\n>> The commands above omit anything that updates the package cache as we\n>> do that anyway in install-dependencies.sh and we only really care\n>> about getting some version of git installed here. It also uses apt-get\n>> to match what we do in install-dependencies.sh\n> \n> OK.\n\n"},{"id":"516588","messageId":"3607a937-9795-4348-981e-dce92203c6d7@gmail.com","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-1-d1e2be4b2078@gmail.com","subject":"Re: [PATCH v5 1/6] ci/github: install git before checking out the repository","fromName":"","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-23T10:05:02Z","receivedAt":"2025-04-23T10:05:05Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Karthik\n\nThis looks good, I've left a few comments about the wording of the \ncommit message but I wouldn't worry too much unless you end up \nre-rolling for some other reason.\n\nOn 23/04/2025 09:15, Karthik Nayak wrote:\n> The GitHub's CI workflow uses 'actions/checkout@v4' to checkout the\n\nWe don't need \"The\" here\n\n> repository. This action defaults to using the GitHub REST API to obtain\n\nI'd maybe say \"falls back\" rather than \"defaults\"\n\n> the repository if the `git` executable isn't available.\n> \n> The step to build Git in the GitHub workflow can be summarized as:\n> \n>    ...\n>    - uses: actions/checkout@v4 #1\n>    - run: ci/install-dependencies.sh #2\n>    ...\n>    - run: sudo --preserve-env --set-home --user=builder ci/run-build-and-tests.sh #3\n>    ...\n> \n> Step #1, clones the repository, since the `git` executable isn't present\n\nIt would be more accurate to say that it tries to clone the repository - \nif we fall back to extracting a tarball then we're not cloning.\n\n> at this step, it uses GitHub's REST API to obtain a tar of the\n> repository.\n> \n> Step #2, installs all dependencies, which includes the `git` executable.\n> \n> Step #3, sets up the build, which includes setting up meson in the meson\n> job. At this point the `git` executable is present.\n> \n> This means while the `git` executable is present, the repository doesn't\n> contain the '.git' folder.\n\nI'd maybe say \"source tree\" instead of \"repository\" as it isn't a \nrepository without a \".git\" directory.\n\n> To keep both the CI's (GitLab and GitHub)\n> behavior consistent and to ensure that the build is performed on a\n> real-world scenario, install `git` before the repository is checked out.\n> This ensures that 'actions/checkout@v4' will clone the repository\n> instead of using a tarball. We also update the package cache while\n> installing `git`, this is because some distros will fail to locate the\n> package without updating the cache.\n\nNice explanation, the code changes look good\n\nThanks\n\nPhillip\n\n> Helped-by: Phillip Wood <phillip.wood123@gmail.com>\n> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n> ---\n>   .github/workflows/main.yml | 14 ++++++++++++++\n>   1 file changed, 14 insertions(+)\n> \n> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\n> index 37541f3d10..e9112b3a64 100644\n> --- a/.github/workflows/main.yml\n> +++ b/.github/workflows/main.yml\n> @@ -414,6 +414,20 @@ jobs:\n>       - name: prepare libc6 for actions\n>         if: matrix.vector.jobname == 'linux32'\n>         run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6\n> +    - name: install git in container\n> +      run: |\n> +        if command -v git\n> +        then\n> +          : # nothing to do\n> +        elif command -v apk\n> +        then\n> +          apk add --update git\n> +        elif command -v dnf\n> +        then\n> +          dnf -yq update && dnf -yq install git\n> +        else\n> +          apt-get -q update && apt-get -q -y install git\n> +        fi\n>       - uses: actions/checkout@v4\n>       - run: ci/install-dependencies.sh\n>       - run: useradd builder --create-home\n> \n\n"},{"id":"516589","messageId":"970e77bb-5e5d-44f5-abbc-201d9e673a89@gmail.com","threadId":"63271","inReplyTo":"CAOLa=ZSi5FuhpaAiGn5OydLUXhkWC9VrkOvXKwTeP=9S2uhKgQ@mail.gmail.com","subject":"Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-23T10:05:15Z","receivedAt":"2025-04-23T10:05:18Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Karthik\n\nOn 22/04/2025 19:56, Karthik Nayak wrote:\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n>> Hi Karthik\n>> The commands above omit anything that updates the package cache as we do\n>> that anyway in install-dependencies.sh and we only really care about\n>> getting some version of git installed here. It also uses apt-get to\n>> match what we do in install-dependencies.sh\n>>\n> \n> Seems like this is a no-go, since apt-get fails [1] without first\n> updating the package cache.\n\nThat's a shame, thanks for trying it\n\n> So I'm going to do that for all the\n> commands, which should also ensure that the package cache update in\n> 'install-dependencies.sh' is mostly a no-op.\n\nFair enough\n\nThanks\n\nPhillip\n> [1]: https://github.com/gitgitgadget/git/actions/runs/14598683520/job/40951070359?pr=1905\n> \n>> I also wonder if we should ditch the checkout action and use something like\n>>\n>>       git clone --depth=1 --single-branch ${GITHUB_REF_NAME} \\\n>> \t${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git\n>>\n>> so that we know we will be building from a git repository.\n>>\n>> Best Wishes\n>>\n>> Phillip\n\n"},{"id":"516590","messageId":"2a25ca04-c824-4bec-a5e7-95ec32556cf9@gmail.com","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-5-d1e2be4b2078@gmail.com","subject":"Re: [PATCH v5 5/6] meson: add support for 'hdr-check'","fromName":"","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-23T10:05:24Z","receivedAt":"2025-04-23T10:05:26Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Karthik\n\nOn 23/04/2025 09:15, Karthik Nayak wrote:\n> The Makefile supports a target called 'hdr-check', which checks if\n> individual header files can be independently compiled. Let's port this\n> functionality to Meson, our new build system too. The implementation\n> resembles that of the Makefile and provides the same check.\n> \n> Since meson builds are out-of-tree, header dependencies are not\n> automatically met. So unlike the Makefile version, we also need to add\n> the required dependencies.\n> \n> Also add the 'xdiff/' dir to the list of 'third_party_sources' as those\n> headers must be skipped from the checks too. This also skips the folder\n> from the 'coccinelle' checks, this is okay, since this code is an\n> external dependency.\n\nThe xdiff code is in a kind of limbo as the upstream project is dead and \nso people who want a standalone copy take the code from our repository. \nThe Makefile does run coccinelle on it but not hdr-check as that fails. \nLooking at the filenames in contrib/coccinelle they are almost all quite \ngit specific so it probably makes sense to skip the xdiff files.\n\nBest Wishes\n\nPhillip\n\n> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n> ---\n>   meson.build | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>   1 file changed, 63 insertions(+)\n> \n> diff --git a/meson.build b/meson.build\n> index 4618804c7a..22fc65ec80 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -645,6 +645,7 @@ third_party_excludes = [\n>     ':!sha1dc',\n>     ':!t/unit-tests/clar',\n>     ':!t/t[0-9][0-9][0-9][0-9]*',\n> +  ':!xdiff',\n>   ]\n>   \n>   headers_to_check = []\n> @@ -1994,6 +1995,68 @@ endif\n>   \n>   subdir('contrib')\n>   \n> +exclude_from_check_headers = [\n> +  'compat/',\n> +  'unicode-width.h',\n> +]\n> +\n> +if sha1_backend != 'openssl'\n> +  exclude_from_check_headers += 'sha1/openssl.h'\n> +endif\n> +if sha256_backend != 'openssl'\n> +  exclude_from_check_headers += 'sha256/openssl.h'\n> +endif\n> +if sha256_backend != 'nettle'\n> +  exclude_from_check_headers += 'sha256/nettle.h'\n> +endif\n> +if sha256_backend != 'gcrypt'\n> +  exclude_from_check_headers += 'sha256/gcrypt.h'\n> +endif\n> +\n> +if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n> +  hco_targets = []\n> +  foreach h : headers_to_check\n> +    skip_header = false\n> +    foreach exclude : exclude_from_check_headers\n> +      if h.startswith(exclude)\n> +        skip_header = true\n> +        break\n> +      endif\n> +    endforeach\n> +\n> +    if skip_header\n> +      continue\n> +    endif\n> +\n> +    hcc = custom_target(\n> +      input: h,\n> +      output: h.underscorify() + 'cc',\n> +      command: [\n> +        shell,\n> +        '-c',\n> +        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n> +      ]\n> +    )\n> +\n> +    hco = custom_target(\n> +      input: hcc,\n> +      output: fs.replace_suffix(h.underscorify(), '.hco'),\n> +      command: [\n> +        compiler.cmd_array(),\n> +        libgit_c_args,\n> +        '-I', meson.project_source_root(),\n> +        '-I', meson.project_source_root() / 't/unit-tests',\n> +        '-o', '/dev/null',\n> +        '-c', '-xc',\n> +        '@INPUT@'\n> +      ]\n> +    )\n> +    hco_targets += hco\n> +  endforeach\n> +\n> +  alias_target('hdr-check', hco_targets)\n> +endif\n> +\n>   foreach key, value : {\n>     'DIFF': diff.full_path(),\n>     'GIT_SOURCE_DIR': meson.project_source_root(),\n> \n\n"},{"id":"516591","messageId":"8a907622-a975-4f9c-86b3-54b8f5447709@gmail.com","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-0-d1e2be4b2078@gmail.com","subject":"Re: [PATCH v5 0/6] meson: add corresponding target for Makefile's hdr-check","fromName":"","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-04-23T10:05:30Z","receivedAt":"2025-04-23T10:05:33Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Karthik\n\nThis looks good, I've left a couple of comments but I don't think there \nis anything that necessitates a re-roll.\n\nThanks\n\nPhillip\n\nOn 23/04/2025 09:15, Karthik Nayak wrote:\n> To bridge the remaining gaps between Makefile and Meson, this patch\n> series adds 'hdr-check' to Meson to compliment the Makefile's\n> 'hdr-check'.\n> \n> We also introduce 'headers-check' as an alias to 'hdr-check' as a better\n> named replacement in both Meson and make and add a note to deprecate\n> 'hdr-check' in the future.\n> \n> The first two commits are small cleanups, where we re-organize existing\n> variables to make it easier to add the target. The third commit adds the\n> 'hdr-check' target to Meson. The last commit introduces the\n> 'headers-check' alias to both Meson and the makefile and marks\n> 'hdr-check' to be deprecated.\n> \n> This is based on master 9d22ac5122 (The third batch, 2025-04-07) with\n> 'es/meson-build-skip-coccinelle' merged in.\n> \n> ---\n> Changes in v5:\n> - Add a commit to install 'git' in GitHub's CI before the repository is\n>    checked out. Without the presence of the 'git' executable, GitHub\n>    downloads a tar of the repo instead of cloning it. This causes the\n>    patch series to fail in CI.\n> - Expose the 'headers_to_check' variable even if 'git' executable is not\n>    found or not a repository. This ensures dependencies of\n>    'headers_to_check' can simply rely on its length. We also check that\n>    the '.git' folder is setup before populating 'headers_to_check', this\n>    ensures Meson doesn't fail in tarball of the Git source code.\n> - Link to v4: https://lore.kernel.org/r/20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com\n> \n> Changes in v4:\n> - Rename headers to headers_to_check, since these headers are only used\n>    for static analysis.\n> - Added a commit to rename third_party_sources -> third_party_excludes\n>    and remove a duplicate.\n> - Fix a typo 'gcrpyt' -> 'gcrypt'\n> - Remove 'generated_headers', since we use 'git ls-files' and that would\n>    already ignore files within '.gitignore'.\n> - Link to v3: https://lore.kernel.org/r/20250414-505-wire-up-sparse-via-meson-v3-0-edc6e7f26745@gmail.com\n> \n> Changes in v3:\n> - Some renames:\n>    - headers_generated -> generated_headers\n>    - meson -> Meson\n>    - headers-check -> check-headers\n>    - headers_check_exclude -> exclude_from_check_headers\n> - Rewrite 'headers_check_exclude' to also contain dirs so we can skip\n>    listing individual header files.\n> - Move 'xdiff/*' to 'third_party_sources' and cleanup\n>    'exclude_from_check_headers'.\n> - Use 'echo' instead of 'echo -n'.\n> - Use `fs.replace_suffix` instead of `str.replace`.\n> - Link to v2: https://lore.kernel.org/r/20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com\n> \n> Changes in v2:\n> - Add 'hdr-check' to meson, while introducing 'headers-check' as\n>    a replacement alias. Schedule 'hdr-check' to be deprecated in the future.\n> - Link to v1: https://lore.kernel.org/r/20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com\n> \n> ---\n>   .github/workflows/main.yml     | 14 +++++++\n>   Makefile                       |  4 +-\n>   ci/run-static-analysis.sh      |  2 +-\n>   contrib/coccinelle/meson.build | 31 ++++-----------\n>   meson.build                    | 86 ++++++++++++++++++++++++++++++++++++++++++\n>   5 files changed, 112 insertions(+), 25 deletions(-)\n> \n> Karthik Nayak (6):\n>        ci/github: install git before checking out the repository\n>        coccinelle: meson: rename variables to be more specific\n>        meson: move headers definition from 'contrib/coccinelle'\n>        meson: rename 'third_party_sources' to 'third_party_excludes'\n>        meson: add support for 'hdr-check'\n>        makefile/meson: add 'check-headers' as alias for 'hdr-check'\n> \n> Range-diff versus v4:\n> \n> -:  ---------- > 1:  d20993a59e ci/github: install git before checking out the repository\n> 1:  0f1160fa78 = 2:  6eb10dd3b1 coccinelle: meson: rename variables to be more specific\n> 2:  933b199def ! 3:  7950b44c6f meson: move headers definition from 'contrib/coccinelle'\n>      @@ Commit message\n>           makes it easier to understand as the variable is now propagated from the\n>           top level to the bottom.\n>       \n>      +    While 'headers_to_check' is only computed when we have a repository and\n>      +    the 'git' executable is present, the variable itself is exposed as an\n>      +    empty array. This allows dependencies in upcoming commits to simply\n>      +    check for length of the array and not worry about dependencies required\n>      +    to actually populate the array.\n>      +\n>           Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>       \n>        ## contrib/coccinelle/meson.build ##\n>      @@ meson.build: builtin_sources = [\n>       +  ':!t/t[0-9][0-9][0-9][0-9]*',\n>       +]\n>       +\n>      -+if git.found()\n>      -+  headers_to_check = []\n>      ++headers_to_check = []\n>      ++if git.found() and fs.exists(meson.project_source_root() / '.git')\n>       +  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n>       +    headers_to_check += header\n>       +  endforeach\n> 3:  ab04192864 ! 4:  7fd64b788b meson: rename 'third_party_sources' to 'third_party_excludes'\n>      @@ meson.build: third_party_sources = [\n>          ':!t/t[0-9][0-9][0-9][0-9]*',\n>        ]\n>        \n>      - if git.found()\n>      -   headers_to_check = []\n>      + headers_to_check = []\n>      + if git.found() and fs.exists(meson.project_source_root() / '.git')\n>       -  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()\n>       +  foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_excludes, check: true).stdout().split()\n>            headers_to_check += header\n> 4:  69a4b5abc9 ! 5:  df0472be57 meson: add support for 'hdr-check'\n>      @@ meson.build: third_party_excludes = [\n>       +  ':!xdiff',\n>        ]\n>        \n>      - if git.found()\n>      + headers_to_check = []\n>       @@ meson.build: endif\n>        \n>        subdir('contrib')\n>      @@ meson.build: endif\n>       +  exclude_from_check_headers += 'sha256/gcrypt.h'\n>       +endif\n>       +\n>      -+if git.found() and compiler.get_argument_syntax() == 'gcc'\n>      ++if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n>       +  hco_targets = []\n>       +  foreach h : headers_to_check\n>       +    skip_header = false\n> 5:  a0c799cf8c ! 6:  7d9a33767b makefile/meson: add 'check-headers' as alias for 'hdr-check'\n>      @@ ci/run-static-analysis.sh: then\n>        make check-pot\n>       \n>        ## meson.build ##\n>      -@@ meson.build: if git.found() and compiler.get_argument_syntax() == 'gcc'\n>      +@@ meson.build: if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n>            hco_targets += hco\n>          endforeach\n>        \n> \n> \n> base-commit: 3a956c5f69873611ae5f8dcb9acd117f66b95ddc\n> change-id: 20250330-505-wire-up-sparse-via-meson-2e32dd31208b\n> \n> Thanks\n> - Karthik\n> \n\n"},{"id":"516595","messageId":"aAjPUGJeOjQHpAKz@pks.im","threadId":"63271","inReplyTo":"20250423-505-wire-up-sparse-via-meson-v5-6-d1e2be4b2078@gmail.com","subject":"Re: [PATCH v5 6/6] makefile/meson: add 'check-headers' as alias for 'hdr-check'","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-04-23T11:30:24Z","receivedAt":"2025-04-23T11:30:30Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Apr 23, 2025 at 10:15:39AM +0200, Karthik Nayak wrote:\n> The 'hdr-check' target in Meson and makefile is used to check if headers\n> can be compiled individually. The naming however isn't readable as 'hdr'\n> is not a common shortforme for 'header', neither is it an abbreviation.\n> \n> Let's introduce 'check-headers' as an alternative target for 'hdr-check'\n> and add a `TODO` to deprecate the latter after 2 releases. Since this\n> is an internal tool, we can use a shorter deprecation cycle.\n> \n> Change existing usage of 'hdr-check' in 'ci/run-static-analysis.sh' to\n> also use 'check-headers'.\n\nI wondered whether we also want to rename `coccicheck` to\n`check-coccinelle` to match. But even if the answer would be \"yes\" I\ndon't think that this change would need to be part of this patch series.\n\nThanks!\n\nPatrick\n"},{"id":"516616","messageId":"CAOLa=ZQJZ0L2wONYJo_JNKSDHHRWQ-sOTuA34FLLgzzZPnHdqg@mail.gmail.com","threadId":"63271","inReplyTo":"3607a937-9795-4348-981e-dce92203c6d7@gmail.com","subject":"Re: [PATCH v5 1/6] ci/github: install git before checking out the repository","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T17:39:39Z","receivedAt":"2025-04-23T17:39:40Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"phillip.wood123@gmail.com writes:\n\n> Hi Karthik\n>\n> This looks good, I've left a few comments about the wording of the\n> commit message but I wouldn't worry too much unless you end up\n> re-rolling for some other reason.\n>\n> On 23/04/2025 09:15, Karthik Nayak wrote:\n>> The GitHub's CI workflow uses 'actions/checkout@v4' to checkout the\n>\n> We don't need \"The\" here\n>\n\nYeah, I think we can remove it.\n\n>> repository. This action defaults to using the GitHub REST API to obtain\n>\n> I'd maybe say \"falls back\" rather than \"defaults\"\n>\n\nRight!\n\n>> the repository if the `git` executable isn't available.\n>>\n>> The step to build Git in the GitHub workflow can be summarized as:\n>>\n>>    ...\n>>    - uses: actions/checkout@v4 #1\n>>    - run: ci/install-dependencies.sh #2\n>>    ...\n>>    - run: sudo --preserve-env --set-home --user=builder ci/run-build-and-tests.sh #3\n>>    ...\n>>\n>> Step #1, clones the repository, since the `git` executable isn't present\n>\n> It would be more accurate to say that it tries to clone the repository -\n> if we fall back to extracting a tarball then we're not cloning.\n>\n\nYes indeed.\n\n>> at this step, it uses GitHub's REST API to obtain a tar of the\n>> repository.\n>>\n>> Step #2, installs all dependencies, which includes the `git` executable.\n>>\n>> Step #3, sets up the build, which includes setting up meson in the meson\n>> job. At this point the `git` executable is present.\n>>\n>> This means while the `git` executable is present, the repository doesn't\n>> contain the '.git' folder.\n>\n> I'd maybe say \"source tree\" instead of \"repository\" as it isn't a\n> repository without a \".git\" directory.\n>\n\nGood point.\n\n>> To keep both the CI's (GitLab and GitHub)\n>> behavior consistent and to ensure that the build is performed on a\n>> real-world scenario, install `git` before the repository is checked out.\n>> This ensures that 'actions/checkout@v4' will clone the repository\n>> instead of using a tarball. We also update the package cache while\n>> installing `git`, this is because some distros will fail to locate the\n>> package without updating the cache.\n>\n> Nice explanation, the code changes look good\n>\n\nThanks for the review. I'll add it locally to my tree. That way if I end\nup with a new version, It'll incorporate these changes.\n\n> Thanks\n>\n> Phillip\n>\n>> Helped-by: Phillip Wood <phillip.wood123@gmail.com>\n>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>> ---\n>>   .github/workflows/main.yml | 14 ++++++++++++++\n>>   1 file changed, 14 insertions(+)\n>>\n>> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\n>> index 37541f3d10..e9112b3a64 100644\n>> --- a/.github/workflows/main.yml\n>> +++ b/.github/workflows/main.yml\n>> @@ -414,6 +414,20 @@ jobs:\n>>       - name: prepare libc6 for actions\n>>         if: matrix.vector.jobname == 'linux32'\n>>         run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6\n>> +    - name: install git in container\n>> +      run: |\n>> +        if command -v git\n>> +        then\n>> +          : # nothing to do\n>> +        elif command -v apk\n>> +        then\n>> +          apk add --update git\n>> +        elif command -v dnf\n>> +        then\n>> +          dnf -yq update && dnf -yq install git\n>> +        else\n>> +          apt-get -q update && apt-get -q -y install git\n>> +        fi\n>>       - uses: actions/checkout@v4\n>>       - run: ci/install-dependencies.sh\n>>       - run: useradd builder --create-home\n>>\n"},{"id":"516621","messageId":"xmqqtt6ezshm.fsf@gitster.g","threadId":"63271","inReplyTo":"8a907622-a975-4f9c-86b3-54b8f5447709@gmail.com","subject":"Re: [PATCH v5 0/6] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-23T17:40:21Z","receivedAt":"2025-04-23T17:40:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"phillip.wood123@gmail.com writes:\n\n> Hi Karthik\n>\n> This looks good, I've left a couple of comments but I don't think\n> there is anything that necessitates a re-roll.\n>\n> Thanks\n>\n> Phillip\n\nThanks, I think the first one that stops us from using tarball\nextract may have the biggest impact on the CI, and might reveal\nsome other bugs (like \"this test used to be skipped because it did\nnot run in a tarball extract, but now this is run and fails\"), which\nmay cause us to scramble to fix them, but I think that would be a\ngood thing in the longer term.\n\nWIll queue.\n"},{"id":"516622","messageId":"CAOLa=ZThKEHa-=Eb+Hef8Q2uoWs1xOZBuHL-KUt0Z5K-uLuJsw@mail.gmail.com","threadId":"63271","inReplyTo":"2a25ca04-c824-4bec-a5e7-95ec32556cf9@gmail.com","subject":"Re: [PATCH v5 5/6] meson: add support for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T17:40:44Z","receivedAt":"2025-04-23T17:40:46Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"phillip.wood123@gmail.com writes:\n\n> Hi Karthik\n>\n> On 23/04/2025 09:15, Karthik Nayak wrote:\n>> The Makefile supports a target called 'hdr-check', which checks if\n>> individual header files can be independently compiled. Let's port this\n>> functionality to Meson, our new build system too. The implementation\n>> resembles that of the Makefile and provides the same check.\n>>\n>> Since meson builds are out-of-tree, header dependencies are not\n>> automatically met. So unlike the Makefile version, we also need to add\n>> the required dependencies.\n>>\n>> Also add the 'xdiff/' dir to the list of 'third_party_sources' as those\n>> headers must be skipped from the checks too. This also skips the folder\n>> from the 'coccinelle' checks, this is okay, since this code is an\n>> external dependency.\n>\n> The xdiff code is in a kind of limbo as the upstream project is dead and\n> so people who want a standalone copy take the code from our repository.\n> The Makefile does run coccinelle on it but not hdr-check as that fails.\n> Looking at the filenames in contrib/coccinelle they are almost all quite\n> git specific so it probably makes sense to skip the xdiff files.\n>\n\nThat was my conclusion indeed. I thought of also removing it from the\nMakefile, but I think that it would be better done outside of this\nseries.\n\n> Best Wishes\n>\n> Phillip\n>\n>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>\n>> ---\n>>   meson.build | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>>   1 file changed, 63 insertions(+)\n>>\n>> diff --git a/meson.build b/meson.build\n>> index 4618804c7a..22fc65ec80 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -645,6 +645,7 @@ third_party_excludes = [\n>>     ':!sha1dc',\n>>     ':!t/unit-tests/clar',\n>>     ':!t/t[0-9][0-9][0-9][0-9]*',\n>> +  ':!xdiff',\n>>   ]\n>>\n>>   headers_to_check = []\n>> @@ -1994,6 +1995,68 @@ endif\n>>\n>>   subdir('contrib')\n>>\n>> +exclude_from_check_headers = [\n>> +  'compat/',\n>> +  'unicode-width.h',\n>> +]\n>> +\n>> +if sha1_backend != 'openssl'\n>> +  exclude_from_check_headers += 'sha1/openssl.h'\n>> +endif\n>> +if sha256_backend != 'openssl'\n>> +  exclude_from_check_headers += 'sha256/openssl.h'\n>> +endif\n>> +if sha256_backend != 'nettle'\n>> +  exclude_from_check_headers += 'sha256/nettle.h'\n>> +endif\n>> +if sha256_backend != 'gcrypt'\n>> +  exclude_from_check_headers += 'sha256/gcrypt.h'\n>> +endif\n>> +\n>> +if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'\n>> +  hco_targets = []\n>> +  foreach h : headers_to_check\n>> +    skip_header = false\n>> +    foreach exclude : exclude_from_check_headers\n>> +      if h.startswith(exclude)\n>> +        skip_header = true\n>> +        break\n>> +      endif\n>> +    endforeach\n>> +\n>> +    if skip_header\n>> +      continue\n>> +    endif\n>> +\n>> +    hcc = custom_target(\n>> +      input: h,\n>> +      output: h.underscorify() + 'cc',\n>> +      command: [\n>> +        shell,\n>> +        '-c',\n>> +        'echo \\'#include \"git-compat-util.h\"\\' > @OUTPUT@ && echo \\'#include \"' + h + '\"\\' >> @OUTPUT@'\n>> +      ]\n>> +    )\n>> +\n>> +    hco = custom_target(\n>> +      input: hcc,\n>> +      output: fs.replace_suffix(h.underscorify(), '.hco'),\n>> +      command: [\n>> +        compiler.cmd_array(),\n>> +        libgit_c_args,\n>> +        '-I', meson.project_source_root(),\n>> +        '-I', meson.project_source_root() / 't/unit-tests',\n>> +        '-o', '/dev/null',\n>> +        '-c', '-xc',\n>> +        '@INPUT@'\n>> +      ]\n>> +    )\n>> +    hco_targets += hco\n>> +  endforeach\n>> +\n>> +  alias_target('hdr-check', hco_targets)\n>> +endif\n>> +\n>>   foreach key, value : {\n>>     'DIFF': diff.full_path(),\n>>     'GIT_SOURCE_DIR': meson.project_source_root(),\n>>\n"},{"id":"516623","messageId":"CAOLa=ZTXjrXgqkQo1S9VgLFrgniQmJTtNwtuVt0+isgsCoLFdA@mail.gmail.com","threadId":"63271","inReplyTo":"aAjPUGJeOjQHpAKz@pks.im","subject":"Re: [PATCH v5 6/6] makefile/meson: add 'check-headers' as alias for 'hdr-check'","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T17:41:13Z","receivedAt":"2025-04-23T17:41:15Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> On Wed, Apr 23, 2025 at 10:15:39AM +0200, Karthik Nayak wrote:\n>> The 'hdr-check' target in Meson and makefile is used to check if headers\n>> can be compiled individually. The naming however isn't readable as 'hdr'\n>> is not a common shortforme for 'header', neither is it an abbreviation.\n>>\n>> Let's introduce 'check-headers' as an alternative target for 'hdr-check'\n>> and add a `TODO` to deprecate the latter after 2 releases. Since this\n>> is an internal tool, we can use a shorter deprecation cycle.\n>>\n>> Change existing usage of 'hdr-check' in 'ci/run-static-analysis.sh' to\n>> also use 'check-headers'.\n>\n> I wondered whether we also want to rename `coccicheck` to\n> `check-coccinelle` to match. But even if the answer would be \"yes\" I\n> don't think that this change would need to be part of this patch series.\n>\n\nI would say 'yes' to both those your statements!\n\n> Thanks!\n>\n> Patrick\n"},{"id":"516624","messageId":"CAOLa=ZSnvTVwooa-S6AE+u1N0MV2D9TBOK3A0NBmCzOF0bjOTg@mail.gmail.com","threadId":"63271","inReplyTo":"8a907622-a975-4f9c-86b3-54b8f5447709@gmail.com","subject":"Re: [PATCH v5 0/6] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T17:42:21Z","receivedAt":"2025-04-23T17:42:23Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"phillip.wood123@gmail.com writes:\n\n> Hi Karthik\n>\n> This looks good, I've left a couple of comments but I don't think there\n> is anything that necessitates a re-roll.\n>\n\nHello,\n\nThanks for your review and guidance, appreciate it. I agree, will hold\noff on re-rolling. Let's see if there are other comments :)\n\n> Thanks\n>\n> Phillip\n>\n\nKarthik\n"},{"id":"516634","messageId":"xmqqv7quwsob.fsf@gitster.g","threadId":"63271","inReplyTo":"xmqqtt6ezshm.fsf@gitster.g","subject":"Re: [PATCH v5 0/6] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-23T20:04:36Z","receivedAt":"2025-04-23T20:04:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> phillip.wood123@gmail.com writes:\n>\n>> Hi Karthik\n>>\n>> This looks good, I've left a couple of comments but I don't think\n>> there is anything that necessitates a re-roll.\n>>\n>> Thanks\n>>\n>> Phillip\n>\n> Thanks, I think the first one that stops us from using tarball\n> extract may have the biggest impact on the CI, and might reveal\n> some other bugs (like \"this test used to be skipped because it did\n> not run in a tarball extract, but now this is run and fails\"), which\n> may cause us to scramble to fix them, but I think that would be a\n> good thing in the longer term.\n\nAs it takes quite a lot of time to do full integration of the day,\nduring which time GitHub CI is idle, I pushed this branch alone as\nif it were the tip of 'seen', and it seems that quite a lot of CI\njobs are now broken,\n\nhttps://github.com/git/git/actions/runs/14624509129/\n\nwith \"Process completed with exit code 8.\" at the end of\nci/install-dependencies.sh step.\n\n\n"},{"id":"516635","messageId":"xmqqr01iwruj.fsf@gitster.g","threadId":"63271","inReplyTo":"xmqqv7quwsob.fsf@gitster.g","subject":"Re: [PATCH v5 0/6] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-23T20:22:28Z","receivedAt":"2025-04-23T20:22:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> As it takes quite a lot of time to do full integration of the day,\n> during which time GitHub CI is idle, I pushed this branch alone as\n> if it were the tip of 'seen', and it seems that quite a lot of CI\n> jobs are now broken,\n>\n> https://github.com/git/git/actions/runs/14624509129/\n>\n> with \"Process completed with exit code 8.\" at the end of\n> ci/install-dependencies.sh step.\n\nYuck.  It's JGit download that is failing.\n"},{"id":"516638","messageId":"CAOLa=ZT+hUuvdMbES_k8Pk+dLgrOovZB4fiRjJpS2AUrRrUogg@mail.gmail.com","threadId":"63271","inReplyTo":"xmqqr01iwruj.fsf@gitster.g","subject":"Re: [PATCH v5 0/6] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T21:22:11Z","receivedAt":"2025-04-23T21:22:14Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> As it takes quite a lot of time to do full integration of the day,\n>> during which time GitHub CI is idle, I pushed this branch alone as\n>> if it were the tip of 'seen', and it seems that quite a lot of CI\n>> jobs are now broken,\n>>\n>> https://github.com/git/git/actions/runs/14624509129/\n>>\n>> with \"Process completed with exit code 8.\" at the end of\n>> ci/install-dependencies.sh step.\n>\n> Yuck.  It's JGit download that is failing.\n\nSigh! I did test on GitHub [1], before pushing the patches to the\nmailing list, so I was really sad to see your first mail. Now I'm not\nsure if I have good luck or bad luck!\n\n[1]: https://github.com/gitgitgadget/git/actions/runs/14604710114/\n"},{"id":"516639","messageId":"xmqqikmuwnly.fsf@gitster.g","threadId":"63271","inReplyTo":"CAOLa=ZT+hUuvdMbES_k8Pk+dLgrOovZB4fiRjJpS2AUrRrUogg@mail.gmail.com","subject":"Re: [PATCH v5 0/6] meson: add corresponding target for Makefile's hdr-check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-23T21:54:01Z","receivedAt":"2025-04-23T21:54:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>> As it takes quite a lot of time to do full integration of the day,\n>>> during which time GitHub CI is idle, I pushed this branch alone as\n>>> if it were the tip of 'seen', and it seems that quite a lot of CI\n>>> jobs are now broken,\n>>>\n>>> https://github.com/git/git/actions/runs/14624509129/\n>>>\n>>> with \"Process completed with exit code 8.\" at the end of\n>>> ci/install-dependencies.sh step.\n>>\n>> Yuck.  It's JGit download that is failing.\n>\n> Sigh! I did test on GitHub [1], before pushing the patches to the\n> mailing list, so I was really sad to see your first mail. Now I'm not\n> sure if I have good luck or bad luck!\n>\n> [1]: https://github.com/gitgitgadget/git/actions/runs/14604710114/\n\nYeah, sorry for a false alarm.  \n\nWith jgit download temporarily disabled, and with all the recent CI\nfixes (like Ubuntu 20.04 updated to newer version, explicitly\ninstalling gawk to fedora environment), most of the tests are\npassing again, except for linux-musl-meson:\n\n  https://github.com/git/git/actions/runs/14627488066\n\nI would expect win+Meson test (2) would time out again; I do not\nknow what is wrong with Windows and have no time to dig further\nthere.\n\nThe tree getting tested in the above run is 'master' with these 6\npatches merged in, nothing else.\n\nThanks.\n"},{"id":"516640","messageId":"CAOLa=ZTK+YFYSMfFwNc=YP5SvMaOa_wABv3G7_Kyi6iqTw74SQ@mail.gmail.com","threadId":"63271","inReplyTo":"xmqqikmuwnly.fsf@gitster.g","subject":"Re: [PATCH v5 0/6] meson: add corresponding target for Makefile's hdr-check","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-04-23T22:12:29Z","receivedAt":"2025-04-23T22:12:30Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Karthik Nayak <karthik.188@gmail.com> writes:\n>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>> Junio C Hamano <gitster@pobox.com> writes:\n>>>\n>>>> As it takes quite a lot of time to do full integration of the day,\n>>>> during which time GitHub CI is idle, I pushed this branch alone as\n>>>> if it were the tip of 'seen', and it seems that quite a lot of CI\n>>>> jobs are now broken,\n>>>>\n>>>> https://github.com/git/git/actions/runs/14624509129/\n>>>>\n>>>> with \"Process completed with exit code 8.\" at the end of\n>>>> ci/install-dependencies.sh step.\n>>>\n>>> Yuck.  It's JGit download that is failing.\n>>\n>> Sigh! I did test on GitHub [1], before pushing the patches to the\n>> mailing list, so I was really sad to see your first mail. Now I'm not\n>> sure if I have good luck or bad luck!\n>>\n>> [1]: https://github.com/gitgitgadget/git/actions/runs/14604710114/\n>\n> Yeah, sorry for a false alarm.\n>\n\nIt's all good, CI reports should _mostly_ be trustable in such regards.\njGit downloads failing is not something to expect.\n\n> With jgit download temporarily disabled, and with all the recent CI\n> fixes (like Ubuntu 20.04 updated to newer version, explicitly\n> installing gawk to fedora environment), most of the tests are\n> passing again, except for linux-musl-meson:\n>\n>   https://github.com/git/git/actions/runs/14627488066\n>\n\nI'm really not sure why this is failing, I see that one of the tests\nfailed\n\n  2025-04-23T20:37:25.0141268Z  764/1021 t7003-filter-branch\n                 FAIL            9.00s   exit status 1\n\nand I also see\n\n  2025-04-23T20:37:25.0161574Z ./t/aggregate-results.sh: line 13:\ncan't open t/test-results/t*-*.counts: no such file\n\ndoesn't seem related to my patches, but again, not sure why this failed,\nso possibly could be?\n\n> I would expect win+Meson test (2) would time out again; I do not\n> know what is wrong with Windows and have no time to dig further\n> there.\n>\n> The tree getting tested in the above run is 'master' with these 6\n> patches merged in, nothing else.\n>\n\nThanks will try and replicate this on gitgitgadget:\n\n  https://github.com/gitgitgadget/git/actions/runs/14629042372\n\n> Thanks.\n"}]}