git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/7] meson: fix outdated completion helpers

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 24, 2026, 14:09 UTC
Message-ID
<20260924-pks-meson-improvements-v1-5-90b7f79f1c4e@pks.im>
In-Reply-To
<20260924-pks-meson-improvements-v1-0-90b7f79f1c4e@pks.im>

When using Meson 1.3.0 or newer, we use `fs.copyfile()` to put our completion helpers into the expected location so that our test suite can find these scripts. Naturally, we thus also add these scripts to our test dependencies so that we know to build them before executing tests. But there's an issue here: we include the "contrib/completion" subdir after we have already wired up our tests, so any dependencies we add here are not being honored correctly. This has the consequence that we don't know to copy around these completion helpers when we execute tests, and one has to manually `meson compile` beforehand.

The interesting part here is that the code path we use with older versions of Meson don't suffer from the same problem as they use `configure_file()`, and that function will always run whenever the source file changes. It's conceptually correct to use `fs.copyfile()` instead, but given that it's mostly creating problems for us it does not really seem sensible to continue using it.

Adapt the build instructions to unconditionally use `configure_file()` to fix this issue.

A better fix would arguably be to promote our shell completion helpers out of "contrib/" -- they are an important part of Git nowadays, and these helpers get installed on lots of platforms. If so, we could also fix the order of subdir includes so that test dependencies are properly honored. But that feels like a bigger change, so that's left for a future patch series.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/completion/meson.build | 38 +++++++++++++++-----------------------
 1 file changed, 15 insertions(+), 23 deletions(-)
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
index 576125b083..4483c5be3e 100644
--- a/contrib/completion/meson.build
+++ b/contrib/completion/meson.build
@@ -4,31 +4,23 @@ foreach script : [
   'git-completion.zsh',
   'git-prompt.sh'
 ]
-  if meson.version().version_compare('>=1.3.0')
-    test_dependencies += fs.copyfile(script)
-  else
-    configure_file(
-      input: script,
-      output: script,
-      copy: true,
-    )
-  endif
+  # Note that we intentionally don't use `fs.copyfile()` here because we'd have
+  # to add it to our test dependencies in that case, but that creates a
+  # chicken-and-egg situation between including "t/" or "contrib/" first.
+  configure_file(
+    input: script,
+    output: script,
+    copy: true,
+  )
 endforeach
 
 # We have to discern between the test dependency and the installed file. Our
 # tests assume the completion scripts to have the same name as the in-tree
 # files, but the installed filenames need to match the executable's basename.
-if meson.version().version_compare('>=1.3.0')
-  fs.copyfile('git-completion.bash', 'git',
-    install: true,
-    install_dir: get_option('datadir') / 'bash-completion/completions',
-  )
-else
-  configure_file(
-    input: 'git-completion.bash',
-    output: 'git',
-    copy: true,
-    install: true,
-    install_dir: get_option('datadir') / 'bash-completion/completions',
-  )
-endif
+configure_file(
+  input: 'git-completion.bash',
+  output: 'git',
+  copy: true,
+  install: true,
+  install_dir: get_option('datadir') / 'bash-completion/completions',
+)
-- 
2.56.0.rc2.329.gd58861e689.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 11 of 20 in “A couple of Meson improvements”
  1. 0/7 A couple of Meson improvementsPatrick Steinhardt, Sep 24, 2026
  2. 1/7 meson: avoid recompiling HTTP sources several timesPatrick Steinhardt, Sep 24, 2026
  3. Karthik NayakSep 30, 2026
  4. Kaartic SivaraamOct 5, 2026
  5. 2/7 meson: don't recompile git-remote-http(1) multiple times for testsPatrick Steinhardt, Sep 24, 2026
  6. 3/7 meson: use precompiled headers for our test-helperPatrick Steinhardt, Sep 24, 2026
  7. Karthik NayakSep 30, 2026
  8. 4/7 meson: use precompiled headers for unit testsPatrick Steinhardt, Sep 24, 2026
  9. Kaartic SivaraamOct 5, 2026
  10. Patrick SteinhardtOct 5, 2026
  11. 5/7 meson: fix outdated completion helpersPatrick Steinhardt, Sep 24, 2026
  12. 6/7 meson: update wrappersPatrick Steinhardt, Sep 24, 2026
  13. Karthik NayakSep 30, 2026
  14. Kaartic SivaraamOct 5, 2026
  15. Patrick SteinhardtOct 5, 2026
  16. 7/7 gitlab-ci: fix hanging MSVC jobsPatrick Steinhardt, Sep 24, 2026
  17. Karthik NayakSep 30, 2026
  18. Patrick SteinhardtSep 30, 2026
  19. Karthik NayakSep 30, 2026
  20. Kaartic SivaraamOct 5, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.