Subject: Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check

From: Junio C Hamano <[email-masked]>
Date: Mon, 21 Apr 2025 13:40:52 -0700

Phillip Wood <[email-masked]> writes:

> On 21/04/2025 16:41, Junio C Hamano wrote:
>> Phillip Wood <[email-masked]> writes:
>> 
>>> "git ls-files" is complaining that there isn't a git
>>> repository. Looking at the output of the checkout action (reproduced
>>> below) it appears it is extracting a tarball rather than using "git
>>> clone" because git is not available. I don't know what the best way to
>>> fix that is - I guess we could run "apt-get install git" before
>>> calling the checkout action.
>> Interesting.  The use of actions/checkout@v4 is nothing new in
>> Karthik's series and we haven't seen this issue come up.  What's so
>> different with this particular series, I have to wonder...
>
> Good Question. Looking at contrib/coccinelle/meson.build which is
> where the invocation of "git ls-files" has been moved from it starts
> with
>
>     coccinelle_opt = get_option('coccinelle').require(
>       fs.exists(meson.project_source_root() / '.git'),
>       error_message: 'coccinelle can only be run from a git checkout',
>     )
>
> I think it is probably fine to skip checking our headers and running
> coccinelle when we don't have a git repository but we should ensure
> the meson build can still be configured in that case by skipping those
> targets. The Makefile falls back to using "find" if "git ls-files"
> fails which is another option.

Yuck.  I somehow thought that CI jobs are always using a git
checkout, not tarball extract (after all, that is what
actions/checkout implies to me X-<).  Of course it is good to
automatically ensure that our tarball extracts are buildable, but
the way tarballs are built upon release is probably different from
how these tarballs are made automatically (*), so in that sense not
building from a repository but building from "git archive" extract
is not doing anybody a service.

[Footnote]

 * "make dist" is how a release tarball is built for this project,
   not "git archive dist.tar HEAD".