From 7208d84305254a882eb93449eee0591875814f1b Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 12 Mar 2025 14:17:32 +0100 Subject: [PATCH 1/3] 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 Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index efe2871c9d..4ddc44f510 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 From 24a3f30c0d006757bddf764855ec8e4dffc70411 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 12 Mar 2025 14:17:33 +0100 Subject: [PATCH 2/3] meson: don't compile git-pack-redundant(1) with breaking changes We continue to compile the git-pack-redundant(1) builtin with Meson when breaking changes are enabled even though we ultimately don't expose this command at all. This is mostly harmless, but given that the intent of the build option is to be as close as possible to the state where the breaking change has been fully implemented this isn't optimal either. Improve the situation by not compiling the builtin when breaking changes are enabled. Based-on-patch-by: Phillip Wood Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 4ddc44f510..6b0eb6430a 100644 --- a/meson.build +++ b/meson.build @@ -581,7 +581,6 @@ builtin_sources = [ 'builtin/name-rev.c', 'builtin/notes.c', 'builtin/pack-objects.c', - 'builtin/pack-redundant.c', 'builtin/pack-refs.c', 'builtin/patch-id.c', 'builtin/prune-packed.c', @@ -632,6 +631,10 @@ builtin_sources = [ 'builtin/write-tree.c', ] +if not get_option('breaking_changes') + builtin_sources += 'builtin/pack-redundant.c' +endif + builtin_sources += custom_target( output: 'config-list.h', command: [ From bbd831ce54ac0e414328a27bbadbb42708c21c5f Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 12 Mar 2025 14:17:34 +0100 Subject: [PATCH 3/3] meson: don't install git-pack-redundant(1) docs with breaking changes When breaking changes are enabled we continue to install documentation of the git-pack-redundant(1) command even though it is completely disabled and thus inaccessible. Improve this by only installing the documentation in case breaking changes aren't enabled. Based-on-patch-by: Karthik Nayak Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- Documentation/Makefile | 2 +- Documentation/meson.build | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index 671267a8ac..e6b20c021f 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -509,7 +509,7 @@ lint-docs-meson: awk "/^manpages = {$$/ {flag=1 ; next } /^}$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047 : [157],\$$/, \"\"); print }" meson.build | \ grep -v -e '#' -e '^$$' | \ sort >tmp-meson-diff/meson.adoc && \ - ls git*.adoc scalar.adoc | grep -v -e git-bisect-lk2009.adoc -e git-tools.adoc >tmp-meson-diff/actual.adoc && \ + ls git*.adoc scalar.adoc | grep -v -e git-bisect-lk2009.adoc -e git-pack-redundant.adoc -e git-tools.adoc >tmp-meson-diff/actual.adoc && \ if ! cmp tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; then \ echo "Meson man pages differ from actual man pages:"; \ diff -u tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; \ diff --git a/Documentation/meson.build b/Documentation/meson.build index 594546d68b..a2de85f5aa 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -96,7 +96,6 @@ manpages = { 'git-notes.adoc' : 1, 'git-p4.adoc' : 1, 'git-pack-objects.adoc' : 1, - 'git-pack-redundant.adoc' : 1, 'git-pack-refs.adoc' : 1, 'git-patch-id.adoc' : 1, 'git-prune-packed.adoc' : 1, @@ -205,6 +204,14 @@ manpages = { 'gitworkflows.adoc' : 7, } +manpages_breaking_changes = { + 'git-pack-redundant.adoc' : 1, +} + +if not get_option('breaking_changes') + manpages += manpages_breaking_changes +endif + docs_backend = get_option('docs_backend') if docs_backend == 'auto' if find_program('asciidoc', dirs: program_path, required: false).found() @@ -479,7 +486,9 @@ endif # Sanity check that we are not missing any tests present in 't/'. This check # only runs once at configure time and is thus best-effort, only. Furthermore, # it only verifies man pages for the sake of simplicity. -configured_manpages = manpages.keys() + [ 'git-bisect-lk2009.adoc', 'git-tools.adoc' ] +configured_manpages = manpages.keys() +configured_manpages += manpages_breaking_changes.keys() +configured_manpages += [ 'git-bisect-lk2009.adoc', 'git-tools.adoc' ] actual_manpages = run_command(shell, '-c', 'ls git*.adoc scalar.adoc', check: true, env: script_environment,