* [PATCH 0/4] Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode
@ 2025-12-02 1:46 brian m. carlson
2025-12-02 1:46 ` [PATCH 1/4] docs: update git hash algorithm for breaking changes mode brian m. carlson
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: brian m. carlson @ 2025-12-02 1:46 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt
When WITH_BREAKING_CHANGES is defined, the default hash algorithm is not
SHA-1, but SHA-256. However, our documentation was never updated to
reflect this, and as a result, we end up misinforming users.
This series fixes four places where we indicate a default hash algorithm
in our documentation such that they conditionally say that either SHA-1
or SHA-256 is the default, based on the the with-breaking-changes
attribute. This both improves accuracy now and also makes it less
likely that we'll forget to update these places when we hit Git 3.0.
brian m. carlson (4):
docs: update git hash algorithm for breaking changes mode
docs: update index-pack hash algorithm for breaking changes mode
docs: update init hash algorithm for breaking changes mode
docs: update show-index hash algorithm for breaking changes mode
Documentation/git-index-pack.adoc | 14 +++++++++++---
Documentation/git-init.adoc | 8 +++++++-
Documentation/git-show-index.adoc | 14 +++++++++++---
Documentation/git.adoc | 8 +++++++-
4 files changed, 36 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] docs: update git hash algorithm for breaking changes mode
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 ` brian m. carlson
2025-12-02 7:04 ` Junio C Hamano
2025-12-02 1:46 ` [PATCH 2/4] docs: update index-pack " brian m. carlson
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: brian m. carlson @ 2025-12-02 1:46 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt
When compiled with WITH_BREAKING_CHANGES, the default hash algorithm
switches to SHA-256, but the documentation doesn't reflect this. Update
the main git manual page to reflect the correct algorithm in this case.
Be sure to conditionalize only full sentences to aid in localization.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
Documentation/git.adoc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Documentation/git.adoc b/Documentation/git.adoc
index ce099e78b8..6123ebcb1b 100644
--- a/Documentation/git.adoc
+++ b/Documentation/git.adoc
@@ -576,7 +576,13 @@ 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.
+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`::
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] docs: update index-pack hash algorithm for breaking changes mode
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 1:46 ` brian m. carlson
2025-12-02 1:46 ` [PATCH 3/4] docs: update init " brian m. carlson
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: brian m. carlson @ 2025-12-02 1:46 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt
When compiled with WITH_BREAKING_CHANGES, the default hash algorithm
switches to SHA-256, but the documentation doesn't reflect this. Update
the index-pack manual page to reflect the correct algorithm in this
case.
Be sure to conditionalize only full sentences to aid in localization.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
Documentation/git-index-pack.adoc | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-index-pack.adoc b/Documentation/git-index-pack.adoc
index 18036953c0..8f05f5494d 100644
--- a/Documentation/git-index-pack.adoc
+++ b/Documentation/git-index-pack.adoc
@@ -125,9 +125,17 @@ information on the possible values of `<msg-id>` and `<severity>`.
--object-format=<hash-algorithm>::
Specify the given object format (hash algorithm) for the pack. The valid
- values are 'sha1' and (if enabled) 'sha256'. The default is the algorithm for
- the current repository (set by `extensions.objectFormat`), or 'sha1' if no
- value is set or outside a repository.
+ values are 'sha1' and (if enabled) 'sha256'.
+ifndef::with-breaking-changes[]
+ The default is the algorithm for the current repository (set by
+ `extensions.objectFormat`), or 'sha1' if no value is set or outside a
+ repository.
+endif::with-breaking-changes[]
+ifdef::with-breaking-changes[]
+ The default is the algorithm for the current repository (set by
+ `extensions.objectFormat`), or 'sha256' if no value is set or outside a
+ repository.
+endif::with-breaking-changes[]
+
This option cannot be used with --stdin.
+
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] docs: update init hash algorithm for breaking changes mode
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 1:46 ` [PATCH 2/4] docs: update index-pack " brian m. carlson
@ 2025-12-02 1:46 ` 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
4 siblings, 0 replies; 8+ messages in thread
From: brian m. carlson @ 2025-12-02 1:46 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt
When compiled with WITH_BREAKING_CHANGES, the default hash algorithm
switches to SHA-256, but the documentation doesn't reflect this. Update
the init manual page to reflect the correct algorithm in this case.
Be sure to conditionalize only full sentences to aid in localization.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
Documentation/git-init.adoc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-init.adoc b/Documentation/git-init.adoc
index bab99b9b47..17dfef4654 100644
--- a/Documentation/git-init.adoc
+++ b/Documentation/git-init.adoc
@@ -53,7 +53,13 @@ current working directory.
`--object-format=<format>`::
Specify the given object _<format>_ (hash algorithm) for the repository. The valid
-values are `sha1` and (if enabled) `sha256`. `sha1` is the default.
+values are `sha1` and (if enabled) `sha256`.
+ifndef::with-breaking-changes[]
+ `sha1` is the default.
+endif::with-breaking-changes[]
+ifdef::with-breaking-changes[]
+ `sha256` is the default.
+endif::with-breaking-changes[]
+
include::object-format-disclaimer.adoc[]
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] docs: update show-index hash algorithm for breaking changes mode
2025-12-02 1:46 [PATCH 0/4] Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode brian m. carlson
` (2 preceding siblings ...)
2025-12-02 1:46 ` [PATCH 3/4] docs: update init " brian m. carlson
@ 2025-12-02 1:46 ` brian m. carlson
2025-12-02 8:18 ` [PATCH 0/4] Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode Patrick Steinhardt
4 siblings, 0 replies; 8+ messages in thread
From: brian m. carlson @ 2025-12-02 1:46 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt
When compiled with WITH_BREAKING_CHANGES, the default hash algorithm
switches to SHA-256, but the documentation doesn't reflect this. Update
the show-index manual page to reflect the correct algorithm in this
case.
Be sure to conditionalize only full sentences to aid in localization.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
Documentation/git-show-index.adoc | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-show-index.adoc b/Documentation/git-show-index.adoc
index 00b3a908cd..af5c114bb8 100644
--- a/Documentation/git-show-index.adoc
+++ b/Documentation/git-show-index.adoc
@@ -41,9 +41,17 @@ OPTIONS
--object-format=<hash-algorithm>::
Specify the given object format (hash algorithm) for the index file. The
- valid values are 'sha1' and (if enabled) 'sha256'. The default is the
- algorithm for the current repository (set by `extensions.objectFormat`), or
- 'sha1' if no value is set or outside a repository..
+ valid values are 'sha1' and (if enabled) 'sha256'.
+ifndef::with-breaking-changes[]
+ The default is the algorithm for the current repository (set by
+ `extensions.objectFormat`), or 'sha1' if no value is set or outside a
+ repository.
+endif::with-breaking-changes[]
+ifdef::with-breaking-changes[]
+ The default is the algorithm for the current repository (set by
+ `extensions.objectFormat`), or 'sha256' if no value is set or outside a
+ repository.
+endif::with-breaking-changes[]
+
include::object-format-disclaimer.adoc[]
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] docs: update git hash algorithm for breaking changes mode
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
0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2025-12-02 7:04 UTC (permalink / raw)
To: brian m. carlson; +Cc: git, Patrick Steinhardt
"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=--
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`::
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode
2025-12-02 1:46 [PATCH 0/4] Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode brian m. carlson
` (3 preceding siblings ...)
2025-12-02 1:46 ` [PATCH 4/4] docs: update show-index " brian m. carlson
@ 2025-12-02 8:18 ` Patrick Steinhardt
2025-12-02 11:52 ` brian m. carlson
4 siblings, 1 reply; 8+ messages in thread
From: Patrick Steinhardt @ 2025-12-02 8:18 UTC (permalink / raw)
To: brian m. carlson; +Cc: git, Junio C Hamano
On Tue, Dec 02, 2025 at 01:46:01AM +0000, brian m. carlson wrote:
> When WITH_BREAKING_CHANGES is defined, the default hash algorithm is not
> SHA-1, but SHA-256. However, our documentation was never updated to
> reflect this, and as a result, we end up misinforming users.
>
> This series fixes four places where we indicate a default hash algorithm
> in our documentation such that they conditionally say that either SHA-1
> or SHA-256 is the default, based on the the with-breaking-changes
> attribute. This both improves accuracy now and also makes it less
> likely that we'll forget to update these places when we hit Git 3.0.
All of these look good to me. One alternative would be to introduce an
attribute that we can then reference in the docs. The below patch shows
how to do this with Asciidoc, but of course we'd also have to do this
for Asciidoctor.
I don't mind much which approach we use, but wanted to suggest this as
an alternative.
Thanks!
Patrick
diff --git a/Documentation/asciidoc.conf.in b/Documentation/asciidoc.conf.in
index ff9ea0a294..fe1c150ec6 100644
--- a/Documentation/asciidoc.conf.in
+++ b/Documentation/asciidoc.conf.in
@@ -24,6 +24,12 @@ litdd=--
manmanual=Git Manual
mansource=Git @GIT_VERSION@
revdate=@GIT_DATE@
+ifndef::with-breaking-changes[]
+default-hash-algo=sha1
+endif::with-breaking-changes[]
+ifdef::with-breaking-changes[]
+default-hash-algo=sha256
+endif::with-breaking-changes[]
ifdef::doctype-book[]
[titles]
diff --git a/Documentation/git-index-pack.adoc b/Documentation/git-index-pack.adoc
index 18036953c0..730c3835e6 100644
--- a/Documentation/git-index-pack.adoc
+++ b/Documentation/git-index-pack.adoc
@@ -126,7 +126,7 @@ information on the possible values of `<msg-id>` and `<severity>`.
--object-format=<hash-algorithm>::
Specify the given object format (hash algorithm) for the pack. The valid
values are 'sha1' and (if enabled) 'sha256'. The default is the algorithm for
- the current repository (set by `extensions.objectFormat`), or 'sha1' if no
+ the current repository (set by `extensions.objectFormat`), or '{default-hash-algo}' if no
value is set or outside a repository.
+
This option cannot be used with --stdin.
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode
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
0 siblings, 0 replies; 8+ messages in thread
From: brian m. carlson @ 2025-12-02 11:52 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Junio C Hamano
[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]
On 2025-12-02 at 08:18:25, Patrick Steinhardt wrote:
> On Tue, Dec 02, 2025 at 01:46:01AM +0000, brian m. carlson wrote:
> > When WITH_BREAKING_CHANGES is defined, the default hash algorithm is not
> > SHA-1, but SHA-256. However, our documentation was never updated to
> > reflect this, and as a result, we end up misinforming users.
> >
> > This series fixes four places where we indicate a default hash algorithm
> > in our documentation such that they conditionally say that either SHA-1
> > or SHA-256 is the default, based on the the with-breaking-changes
> > attribute. This both improves accuracy now and also makes it less
> > likely that we'll forget to update these places when we hit Git 3.0.
>
> All of these look good to me. One alternative would be to introduce an
> attribute that we can then reference in the docs. The below patch shows
> how to do this with Asciidoc, but of course we'd also have to do this
> for Asciidoctor.
>
> I don't mind much which approach we use, but wanted to suggest this as
> an alternative.
I think it may be easier to set this in the Makefile and Meson config,
but I'll try to see if I can adopt a similar approach here and if so,
I'll send a v2.
--
brian m. carlson (they/them)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-12-02 11:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).