Skip to content

Commit 7208d84

Browse files
pks-tgitster
authored andcommitted
meson: define WITH_BREAKING_CHANGES when enabling breaking changes
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 <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 87a0bdb commit 7208d84

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

meson.build

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -672,12 +672,6 @@ build_options_config.set_quoted('GIT_TEST_UTF8_LOCALE', get_option('test_utf8_lo
672672
build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
673673
build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
674674

675-
if get_option('breaking_changes')
676-
build_options_config.set('WITH_BREAKING_CHANGES', 'YesPlease')
677-
else
678-
build_options_config.set('WITH_BREAKING_CHANGES', '')
679-
endif
680-
681675
if get_option('sane_tool_path').length() != 0
682676
sane_tool_path = (host_machine.system() == 'windows' ? ';' : ':').join(get_option('sane_tool_path'))
683677
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
739733
endforeach
740734
endif
741735

736+
if get_option('breaking_changes')
737+
build_options_config.set('WITH_BREAKING_CHANGES', 'YesPlease')
738+
libgit_c_args += '-DWITH_BREAKING_CHANGES'
739+
else
740+
build_options_config.set('WITH_BREAKING_CHANGES', '')
741+
endif
742+
742743
if get_option('b_sanitize').contains('address')
743744
build_options_config.set('SANITIZE_ADDRESS', 'YesCompiledWithIt')
744745
else

0 commit comments

Comments
 (0)