git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] meson: Check whether git is new enough to support ls-files --deduplicate
@ 2025-07-31 12:15 Martin Storsjö
  2025-08-01  5:27 ` Patrick Steinhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Storsjö @ 2025-07-31 12:15 UTC (permalink / raw)
  To: git

This fixes Meson errors like this:

    ../meson.build:697:19: ERROR: Command `/usr/bin/git -C /home/martin/code/git ls-files --deduplicate '*.h' ':!contrib' ':!compat/inet_ntop.c' ':!compat/inet_pton.c' ':!compat/nedmalloc' ':!compat/obstack.*' ':!compat/poll' ':!compat/regex' ':!sha1collisiondetection' ':!sha1dc' ':!t/unit-tests/clar' ':!t/t[0-9][0-9][0-9][0-9]*' ':!xdiff'` failed with status 129.

Unfortunately, Meson only supports the external_program.version()
method since Meson 0.62. So with older versions of Meson, we have
to just assume that it exists (or maybe assume that it doesn't).

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 meson.build | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 9bc1826cb6..717365baec 100644
--- a/meson.build
+++ b/meson.build
@@ -693,7 +693,14 @@ third_party_excludes = [
 ]
 
 headers_to_check = []
-if git.found() and fs.exists(meson.project_source_root() / '.git')
+if meson.version().version_compare('>=0.62')
+  new_enough_git = git.found() and git.version().version_compare('>=2.31')
+else
+  # On Meson 0.61, we can't check git.version(), so we just have to
+  # assume that the found git is new enough.
+  new_enough_git = git.found()
+endif
+if new_enough_git and fs.exists(meson.project_source_root() / '.git')
   foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_excludes, check: true).stdout().split()
     headers_to_check += header
   endforeach
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-08-01 16:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31 12:15 [PATCH] meson: Check whether git is new enough to support ls-files --deduplicate Martin Storsjö
2025-08-01  5:27 ` Patrick Steinhardt
2025-08-01  7:55   ` Martin Storsjö
2025-08-01  7:56     ` [PATCH v2] meson: Tolerate errors from git " Martin Storsjö
2025-08-01  9:23       ` Patrick Steinhardt
2025-08-01  9:42         ` Martin Storsjö
2025-08-01  9:45           ` Patrick Steinhardt
2025-08-01 10:24             ` Martin Storsjö
2025-08-01 10:25               ` [PATCH v3] " Martin Storsjö
2025-08-01 14:44                 ` Patrick Steinhardt
2025-08-01 15:59       ` [PATCH v2] " Junio C Hamano
2025-08-01 16:27         ` Martin Storsjö
2025-08-01 16:28           ` [PATCH v4] " Martin Storsjö

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).