From: Karthik Nayak Date: Mon, 30 Jun 2025 08:34:48 GMT Subject: Re: [PATCH 4/4] meson: add rule to run 'git clang-format' Message-ID: In-Reply-To: Junio C Hamano writes: > Karthik Nayak writes: > >>>> diff --git a/meson.build b/meson.build >>>> index 7fea4a34d6..578db26df2 100644 >>>> --- a/meson.build >>>> +++ b/meson.build >>>> @@ -2144,6 +2144,18 @@ if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc' >>>> alias_target('check-headers', hdr_check) >>>> endif >>>> >>>> +clang_format = find_program('clang-format', required: false) >>> >>> Should we be checking for `git-clang-format` instead? >>> >> >> Yeah. While `git-clang-format` is packaged with `clang-format`, it does >> make more sense to check for the former. > > Just for my education, what does find_program() look for? Installed > packages, or a program on your $PATH? I am guessing that the answer > is the latter, in which case it is not like "it makes more sense to > check for git-clang-format"---rather it is "it would not work at all > if we looked for clang-format", no? > > Thanks. Good question. To quote from the documentation [1]: find_program() program_name here is a string that can be an executable or script to be searched for in PATH or other places inside the project. So, 'git-clang-format' would work. I've also verified the same on my end. [1]: https://mesonbuild.com/Reference-manual_functions.html#find_program