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

Re: [PATCH 0/4] Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode

From
Patrick Steinhardt <ps@pks.im>
Date
Dec 2, 2025, 08:18 UTC
Message-ID
<aS6g0Zjzd5OEd-mb@pks.im>
In-Reply-To
<20251202014605.52110-1-sandals@crustytoothpaste.net>
On Tue, Dec 02, 2025 at 01:46:01AM +0000, brian m. carlson wrote:
Show 9 quoted lines
> 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=&#45;&#45;
 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.
Previous: brian m. carlsonNext: brian m. carlson
Message 7 of 8 in “Fix doc default hash algorithm in WITH_BREAKING_CHANGES mode”
  1. 0/4 Fix doc default hash algorithm in WITH_BREAKING_CHANGES modebrian m. carlson, Dec 2, 2025
  2. 4/4 docs: update show-index hash algorithm for breaking changes modebrian m. carlson, Dec 2, 2025
  3. 1/4 docs: update git hash algorithm for breaking changes modebrian m. carlson, Dec 2, 2025
  4. Junio C HamanoDec 2, 2025
  5. 2/4 docs: update index-pack hash algorithm for breaking changes modebrian m. carlson, Dec 2, 2025
  6. 3/4 docs: update init hash algorithm for breaking changes modebrian m. carlson, Dec 2, 2025
  7. Patrick SteinhardtDec 2, 2025
  8. brian m. carlsonDec 2, 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.