git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: <git@vger.kernel.org>,  Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH 1/4] docs: update git hash algorithm for breaking changes mode
Date: Mon, 01 Dec 2025 23:04:18 -0800	[thread overview]
Message-ID: <xmqqjyz58ivh.fsf@gitster.g> (raw)
In-Reply-To: <20251202014605.52110-2-sandals@crustytoothpaste.net> (brian m. carlson's message of "Tue, 2 Dec 2025 01:46:02 +0000")

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> +ifndef::with-breaking-changes[]
> +	The default is "sha1".
> +endif::with-breaking-changes[]
> +ifdef::with-breaking-changes[]
> +	The default is "sha256".
> +endif::with-breaking-changes[]
>  	See `--object-format` in linkgit:git-init[1].
>  
>  `GIT_DEFAULT_REF_FORMAT`::

I wonder if we can have a macro definition at a central location, so
that we can refer to the text without "ifdef" everywhere?

Caution: this illustration of the idea seems to work with AsciiDoc
but it was typed in an airline lounge with rum-and-coke in my left
hand and haven't been tested with Asciidoctor at all.  I do not even
understand why many other [attributes] entries like {asterisk} can
successfully be grokked by Asciidoctor, but we seem to do -alitdd=<>
in the Makefile for Asciidoctor, so I mimicked it without fully
understanding what is going on.

But the patch should be good enough to illustrate the idea.

 Documentation/Makefile         | 5 +++++
 Documentation/asciidoc.conf.in | 6 ++++++
 Documentation/git.adoc         | 2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git c/Documentation/Makefile w/Documentation/Makefile
index 04e9e10b27..88b8ed55a2 100644
--- c/Documentation/Makefile
+++ w/Documentation/Makefile
@@ -222,6 +222,11 @@ ASCIIDOC_DOCBOOK = docbook5
 ASCIIDOC_EXTRA += -acompat-mode -atabsize=8
 ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
 ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
+ifdef WITH_BREAKING_CHANGES
+ASCIIDOC_EXTRA += -adefaulthash=sha256
+else
+ASCIIDOC_EXTRA += -adefaulthash=sha1
+endif
 ASCIIDOC_EXTRA += -adocinfo=shared
 ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
 DBLATEX_COMMON =
diff --git c/Documentation/asciidoc.conf.in w/Documentation/asciidoc.conf.in
index ff9ea0a294..2de6b80197 100644
--- c/Documentation/asciidoc.conf.in
+++ w/Documentation/asciidoc.conf.in
@@ -24,6 +24,12 @@ litdd=&#45;&#45;
 manmanual=Git Manual
 mansource=Git @GIT_VERSION@
 revdate=@GIT_DATE@
+ifdef::with-breaking-changes[]
+defaulthash=sha256
+endif::with-breaking-changes[]
+ifndef::with-breaking-changes[]
+defaulthash=sha1
+endif::with-breaking-changes[]
 
 ifdef::doctype-book[]
 [titles]
diff --git c/Documentation/git.adoc w/Documentation/git.adoc
index 8c6a3f6042..f21dbba5a1 100644
--- c/Documentation/git.adoc
+++ w/Documentation/git.adoc
@@ -576,7 +576,7 @@ double-quotes and respecting backslash escapes. E.g., the value
 	If this variable is set, the default hash algorithm for new
 	repositories will be set to this value. This value is
 	ignored when cloning and the setting of the remote repository
-	is always used. The default is "sha1".
+	is always used. The default is "{defaulthash}".
 	See `--object-format` in linkgit:git-init[1].
 
 `GIT_DEFAULT_REF_FORMAT`::

  reply	other threads:[~2025-12-02  7:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02  1:46 [PATCH 0/4] Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode brian m. carlson
2025-12-02  1:46 ` [PATCH 1/4] docs: update git hash algorithm for breaking changes mode brian m. carlson
2025-12-02  7:04   ` Junio C Hamano [this message]
2025-12-02  1:46 ` [PATCH 2/4] docs: update index-pack " brian m. carlson
2025-12-02  1:46 ` [PATCH 3/4] docs: update init " brian m. carlson
2025-12-02  1:46 ` [PATCH 4/4] docs: update show-index " brian m. carlson
2025-12-02  8:18 ` [PATCH 0/4] Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode Patrick Steinhardt
2025-12-02 11:52   ` brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqjyz58ivh.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).