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

[PATCH 1/3] meson: define WITH_BREAKING_CHANGES when enabling breaking changes

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 12, 2025, 13:17 UTC
Message-ID
<20250312-b4-pks-meson-breaking-changes-v1-1-b89e9a59d228@pks.im>
In-Reply-To
<20250312-b4-pks-meson-breaking-changes-v1-0-b89e9a59d228@pks.im>

While Meson already supports the `-Dbreaking_changes=true` option, it only wires up the build option that propagates into the tests. The build option is only used for our tests to enable the `WITH_BREAKING_CHANGES` prerequisite though, and does not influence the code that is actually being built.

The omission went unnoticed because we only have tests right now that get disabled when breaking changes are enabled, but not the other way round. In other words, we don't have any tests that verify that breaking changes behave as expected.

Fix the build issue by setting the `WITH_BREAKING_CHANGES` preprocessor macro when breaking changes are enabled. Note that the `libgit_c_args` array is defined after the current spot where we handle the option, so to not have multiple sites where we handle it we instead move it after the array has been defined.

Based-on-patch-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 meson.build | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index efe2871c9db..4ddc44f510d 100644
--- a/meson.build
+++ b/meson.build
@@ -672,12 +672,6 @@ build_options_config.set_quoted('GIT_TEST_UTF8_LOCALE', get_option('test_utf8_lo
 build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
 build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
 
-if get_option('breaking_changes')
-  build_options_config.set('WITH_BREAKING_CHANGES', 'YesPlease')
-else
-  build_options_config.set('WITH_BREAKING_CHANGES', '')
-endif
-
 if get_option('sane_tool_path').length() != 0
   sane_tool_path = (host_machine.system() == 'windows' ? ';' : ':').join(get_option('sane_tool_path'))
   build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\# @BROKEN_PATH_FIX@$|git_broken_path_fix "' + sane_tool_path + '"|')
@@ -739,6 +733,13 @@ if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argum
   endforeach
 endif
 
+if get_option('breaking_changes')
+  build_options_config.set('WITH_BREAKING_CHANGES', 'YesPlease')
+  libgit_c_args += '-DWITH_BREAKING_CHANGES'
+else
+  build_options_config.set('WITH_BREAKING_CHANGES', '')
+endif
+
 if get_option('b_sanitize').contains('address')
   build_options_config.set('SANITIZE_ADDRESS', 'YesCompiledWithIt')
 else
-- 
2.49.0.rc2.394.gf6994c5077.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 2 of 11 in “meson: improve handling of `-Dbreaking_changes=true`”
  1. 0/3 meson: improve handling of `-Dbreaking_changes=true`Patrick Steinhardt, Mar 12, 2025
  2. 1/3 meson: define WITH_BREAKING_CHANGES when enabling breaking changesPatrick Steinhardt, Mar 12, 2025
  3. 2/3 meson: don't compile git-pack-redundant(1) with breaking changesPatrick Steinhardt, Mar 12, 2025
  4. 3/3 meson: don't install git-pack-redundant(1) docs with breaking changesPatrick Steinhardt, Mar 12, 2025
  5. Karthik NayakMar 13, 2025
  6. Phillip WoodMar 16, 2025
  7. Patrick SteinhardtMar 17, 2025
  8. Phillip WoodMar 17, 2025
  9. Phillip WoodMar 18, 2025
  10. Patrick SteinhardtMar 19, 2025
  11. Karthik NayakMar 13, 2025

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.