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

[PATCH v4 1/5] Makefile: wire up build option for deprecated features

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 22, 2025, 11:31 UTC
Message-ID
<20250122-pks-remote-branches-deprecation-v4-1-5cbf5b28afd5@pks.im>
In-Reply-To
<20250122-pks-remote-branches-deprecation-v4-0-5cbf5b28afd5@pks.im>

With 57ec9254eb (docs: introduce document to announce breaking changes, 2024-06-14), we have introduced a new document that tracks upcoming breaking changes in the Git project. In 2454970930 (BreakingChanges: early adopter option, 2024-10-11) we have amended the document a bit to mention that any introduced breaking changes must be accompanied by logic that allows us to enable the breaking change at compile-time. While we already have two breaking changes lined up, neither of them has such a switch because they predate those instructions.

Introduce the proposed `WITH_BREAKING_CHANGES` preprocessor macro and wire it up with both our Makefiles and Meson. This does not yet wire up the build flag for existing deprecations.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 GIT-BUILD-OPTIONS.in                | 1 +
 Makefile                            | 5 +++++
 contrib/buildsystems/CMakeLists.txt | 1 +
 meson.build                         | 6 ++++++
 meson_options.txt                   | 2 ++
 t/test-lib.sh                       | 4 ++++
 6 files changed, 19 insertions(+)
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index f651116102..f1d0ecf123 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -45,3 +45,4 @@ GITWEBDIR=@GITWEBDIR@
 USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
 LOCALEDIR=@LOCALEDIR@
 BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
+WITH_BREAKING_CHANGES=@WITH_BREAKING_CHANGES@
diff --git a/Makefile b/Makefile
index 06f01149ec..dc3c980aa7 100644
--- a/Makefile
+++ b/Makefile
@@ -2230,6 +2230,10 @@ ifdef FSMONITOR_OS_SETTINGS
 	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
 endif
 
+ifdef WITH_BREAKING_CHANGES
+	BASIC_CFLAGS += -DWITH_BREAKING_CHANGES
+endif
+
 ifeq ($(TCLTK_PATH),)
 NO_TCLTK = NoThanks
 endif
@@ -3187,6 +3191,7 @@ GIT-BUILD-OPTIONS: FORCE
 		-e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
 		-e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
 		-e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
+		-e "s|@WITH_BREAKING_CHANGES@|\'$(WITH_BREAKING_CHANGES)\'|" \
 		GIT-BUILD-OPTIONS.in >$@+
 	@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
 	@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 49904ca8a9..63d0088928 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1198,6 +1198,7 @@ string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_opt
 string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
 string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
 string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@WITH_BREAKING_CHANGES@" "" git_build_options "${git_build_options}")
 if(USE_VCPKG)
 	string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
 endif()
diff --git a/meson.build b/meson.build
index 0dccebcdf1..316cd93264 100644
--- a/meson.build
+++ b/meson.build
@@ -644,6 +644,12 @@ build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
 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') != ''
   build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\# @BROKEN_PATH_FIX@$|git_broken_path_fix "' + get_option('sane_tool_path') + '"|')
 else
diff --git a/meson_options.txt b/meson_options.txt
index 32a72139ba..800e518d95 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -43,6 +43,8 @@ option('sha256_backend', type: 'combo', choices: ['openssl', 'nettle', 'gcrypt',
   description: 'The backend used for hashing objects with the SHA256 object format')
 
 # Build tweaks.
+option('breaking_changes', type: 'boolean', value: false,
+  description: 'Enable upcoming breaking changes.')
 option('macos_use_homebrew_gettext', type: 'boolean', value: true,
   description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
 
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 62dfcc4aaf..6e423f655d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1864,6 +1864,10 @@ test_lazy_prereq CURL '
 	curl --version
 '
 
+test_lazy_prereq WITHOUT_BREAKING_CHANGES '
+	test -z "$WITH_BREAKING_CHANGES"
+'
+
 # SHA1 is a test if the hash algorithm in use is SHA-1.  This is both for tests
 # which will not work with other hash algorithms and tests that work but don't
 # test anything meaningful (e.g. special values which cause short collisions).
-- 
2.48.1.321.gbf1f004a4a.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 37 of 47 in “remote: announce removal of "branches/" and "remotes/"”
  1. 0/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Dec 11, 2024
  2. 1/5 Makefile: wire up build option for deprecated featuresPatrick Steinhardt, Dec 11, 2024
  3. Kristoffer HaugsbakkDec 11, 2024
  4. Patrick SteinhardtDec 13, 2024
  5. 2/5 ci: merge linux-gcc-default into linux-gccPatrick Steinhardt, Dec 11, 2024
  6. 3/5 ci: repurpose "linux-gcc" job for deprecationsPatrick Steinhardt, Dec 11, 2024
  7. 4/5 builtin/pack-redundant: remove subcommand with breaking changesPatrick Steinhardt, Dec 11, 2024
  8. 5/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Dec 11, 2024
  9. 0/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Jan 6, 2025
  10. 1/5 Makefile: wire up build option for deprecated featuresPatrick Steinhardt, Jan 6, 2025
  11. Christian CouderJan 6, 2025
  12. Christian CouderJan 6, 2025
  13. 2/5 ci: merge linux-gcc-default into linux-gccPatrick Steinhardt, Jan 6, 2025
  14. Christian CouderJan 6, 2025
  15. Junio C HamanoJan 6, 2025
  16. Patrick SteinhardtJan 7, 2025
  17. Christian CouderJan 7, 2025
  18. 3/5 ci: repurpose "linux-gcc" job for deprecationsPatrick Steinhardt, Jan 6, 2025
  19. 4/5 builtin/pack-redundant: remove subcommand with breaking changesPatrick Steinhardt, Jan 6, 2025
  20. 5/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Jan 6, 2025
  21. Christian CouderJan 6, 2025
  22. Junio C HamanoJan 6, 2025
  23. Patrick SteinhardtJan 7, 2025
  24. Junio C HamanoJan 7, 2025
  25. Junio C HamanoJan 7, 2025
  26. rsbecker@nexbridge.comJan 7, 2025
  27. Patrick SteinhardtJan 8, 2025
  28. Junio C HamanoJan 8, 2025
  29. Patrick SteinhardtJan 9, 2025
  30. Robert CoupJan 9, 2025
  31. Patrick SteinhardtJan 9, 2025
  32. Junio C HamanoJan 9, 2025
  33. Junio C HamanoJan 6, 2025
  34. Patrick SteinhardtJan 7, 2025
  35. Junio C HamanoJan 7, 2025
  36. 0/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Jan 22, 2025
  37. 1/5 Makefile: wire up build option for deprecated featuresPatrick Steinhardt, Jan 22, 2025
  38. 2/5 ci: merge linux-gcc-default into linux-gccPatrick Steinhardt, Jan 22, 2025
  39. 3/5 ci: repurpose "linux-gcc" job for deprecationsPatrick Steinhardt, Jan 22, 2025
  40. 4/5 builtin/pack-redundant: remove subcommand with breaking changesPatrick Steinhardt, Jan 22, 2025
  41. 5/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Jan 22, 2025
  42. Junio C HamanoJan 22, 2025
  43. Jakub WilkFeb 21, 2025
  44. Junio C HamanoFeb 21, 2025
  45. Patrick SteinhardtFeb 25, 2025
  46. Junio C HamanoFeb 25, 2025
  47. Patrick SteinhardtFeb 26, 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.