docs: fix repository-layout when building with breaking changes

Since commit 8ccc75c2452 (remote: announce removal of "branches/" and "remotes/", 2025-01-22) enabling WITH_BREAKING_CHANGES when building git removes support for reading branches from ".git/branches" and remotes from ".git/remotes". However those locations are still documented in gitrepository-layout.adoc even though the build does not support them. Rectify this by adding a new document attribute "with-breaking-changes" and use it to make the inclusion of those sections of the documentation conditional. Note that the name of the attribute does not match the test prerequisite WITHOUT_BREAKING_CHANGES added in c5bc9a7f94a (Makefile: wire up build option for deprecated features, 2025-01-22). This is to avoid the awkward double negative ifndef::without_breaking_changes for documentation that should be included when WITH_BREAKING_CHANGES is enabled. The test prerequisite will be renamed to match the documentation attribute in a future patch series. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Phillip Wood committed Mar 5, 2025 at 10:42 UTC 92f8da8de36decbfcc4e30dc069b2c9ea28e3f6a
3 files changed +12
Documentation/Makefile
+4
@@ -224,6 +224,10 @@ asciidoc.conf: asciidoc.conf.in FORCE
224 $(QUIET_GEN)$(call version_gen,"$(shell pwd)/..",$<,$@)
225 endif
226
227 +ifdef WITH_BREAKING_CHANGES
228 +ASCIIDOC_EXTRA += -awith-breaking-changes
229 +endif
230 +
231 ASCIIDOC_DEPS += docinfo.html
232
233 SHELL_PATH ?= $(SHELL)
Documentation/gitrepository-layout.adoc
+4
@@ -152,6 +152,7 @@ config.worktree::
152 working directory in multiple working directory setup (see
153 linkgit:git-worktree[1]).
154
155 +ifndef::with-breaking-changes[]
156 branches::
157 A deprecated way to store shorthands to be used
158 to specify a URL to 'git fetch', 'git pull' and 'git push'.
@@ -164,6 +165,7 @@ branches::
165 "$GIT_COMMON_DIR/branches" will be used instead.
166 +
167 Git will stop reading remotes from this directory in Git 3.0.
168 +endif::with-breaking-changes[]
169
170 hooks::
171 Hooks are customization scripts used by various Git
@@ -231,6 +233,7 @@ info/sparse-checkout::
233 This file stores sparse checkout patterns.
234 See also: linkgit:git-read-tree[1].
235
236 +ifndef::with-breaking-changes[]
237 remotes::
238 Stores shorthands for URL and default refnames for use
239 when interacting with remote repositories via 'git fetch',
@@ -241,6 +244,7 @@ remotes::
244 "$GIT_COMMON_DIR/remotes" will be used instead.
245 +
246 Git will stop reading remotes from this directory in Git 3.0.
247 +endif::with-breaking-changes[]
248
249 logs::
250 Records of changes made to refs are stored in this directory.
Documentation/meson.build
+4
@@ -284,6 +284,10 @@ elif docs_backend == 'asciidoctor'
284 ]
285 endif
286
287 +if get_option('breaking_changes')
288 + asciidoc_common_options += ['--attribute', 'with-breaking-changes']
289 +endif
290 +
291 xmlto = find_program('xmlto', dirs: program_path)
292
293 cmd_lists = [