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

Default object format for new repositories in Git v3

From
Adam Dinwoodie <adam@dinwoodie.org>
Date
Nov 6, 2026, 16:50 UTC
Message-ID
<CA+kUOampvjU3=VK3VGhYw2L5-E+LBsk=Q0UrAxhhR7hC5SUdJg@mail.gmail.com>
Hi folks,

As part of preparing for Git v3, in particular for Nixpkgs, I've been running a bunch of tests using Git built with `WITH_BREAKING_CHANGES=1`. Somewhat to my surprise, `git init` seems to still be creating new repositories using sha1 rather than sha256. Is this expected?

For reference, I've attached the test script I've produced as a repro that can be run from the root of a Git checkout, although it does require Nix. I've confirmed the behaviour at v2.56.0, next (972d6e3ab651d838b30a8d5d70d8ef6ced05a986) and main (0ffa3e35c7c82ab8d0de226149fb03b3f7674d05).

For a simpler repro that doesn't require Nix, build Git with `WITH_BREAKING_CHANGES=1`, then run:

``` git init tmpdir git -C tmpdir rev-parse --show-object-format ```

This will print "sha1", when I'd expect "sha256".

#!/usr/bin/env nix #!nix shell #!nix --override-flake nixpkgs https://releases.nixos.org/nixos/unstable/nixos-26.11pre1105037.1c89083e451e/nixexprs.tar.zst #!nix --ignore-env #!nix nixpkgs#bash nixpkgs#coreutils nixpkgs#nix nixpkgs#findutils nixpkgs#gnused nixpkgs#autoconf nixpkgs#gnumake nixpkgs#gcc nixpkgs#cargo #!nix --command bash

set -euo pipefail

tmpdir="$(mktemp --dir)" trap 'rm -rf -- "$tmpdir"' EXIT

# Get the paths we need for zlib-ng export NIX_PATH=nixpkgs=https://releases.nixos.org/nixos/unstable/nixos-26.11pre1105037.1c89083e451e/nixexprs.tar.zst nix-build '<nixpkgs>' -A zlib-ng -A zlib-ng.dev -o "$tmpdir"/zlib-ng zlib_lib="$(realpath "$tmpdir"/zlib-ng)" zlib_dev="$(realpath "$tmpdir"/zlib-ng-dev)"

# Work out how much to parallelise the builds jobs="$(nproc)"

# Make sure the build process can find zlib-ng export CPPFLAGS="-isystem $zlib_dev/include" LDFLAGS="-L$zlib_lib/lib -Wl,-rpath,$zlib_lib"

# Set options: disable features we don't need for speed of building, use # zlib-ng, enable breaking changes. export ZLIB_NG=1 WITH_BREAKING_CHANGES=1 NO_TCLTK=1 NO_GETTEXT=1

# Build git make -j"$jobs" configure ./configure make -j"$jobs"

# Make sure Git config doesn't have anything unexpected export GIT_CONFIG_GLOBAL=/dev/null export GIT_CONFIG_SYSTEM=/dev/null export GIT_CONFIG=/dev/null export GIT_CONFIG_COUNT=2 export GIT_CONFIG_KEY_0=user.name GIT_CONFIG_VALUE_0=Adam export GIT_CONFIG_KEY_1=user.email GIT_CONFIG_VALUE_1=adam@localhost export GIT_PAGER=cat

# Make sure calling `git` gets the right executable export PATH="$PWD":"$PATH"

# Set up a simple repository with a single commit git init "$tmpdir"/repo cd "$tmpdir"/repo touch test-file git add test-file git commit -m 'demo commit'

# Show everything's sha1 rather than sha256 git log --format=raw git rev-parse --show-object-format

Next: brian m. carlson
Message 1 of 11 in “Default object format for new repositories in Git v3”
  1. Adam DinwoodieNov 6, 2026
  2. brian m. carlsonNov 6, 2026
  3. setup: default hash algo to GIT_HASH_DEFAULTbrian m. carlson, Nov 8, 2026
  4. Junio C HamanoNov 8, 2026
  5. brian m. carlsonNov 8, 2026
  6. Junio C HamanoNov 8, 2026
  7. Junio C HamanoNov 9, 2026
  8. Patrick SteinhardtNov 9, 2026
  9. setup: fix hash algorithm detectionbrian m. carlson, Nov 13, 2026
  10. Junio C HamanoNov 14, 2026
  11. Patrick SteinhardtNov 16, 2026

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.