Git development
 help / color / mirror / Atom feed
* Default object format for new repositories in Git v3
@ 2026-11-06 16:50 Adam Dinwoodie
  2026-11-06 20:46 ` brian m. carlson
  2026-11-08  1:16 ` [PATCH] setup: default hash algo to GIT_HASH_DEFAULT brian m. carlson
  0 siblings, 2 replies; 7+ messages in thread
From: Adam Dinwoodie @ 2026-11-06 16:50 UTC (permalink / raw)
  To: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

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".

[-- Attachment #2: test.sh --]
[-- Type: text/x-sh, Size: 1832 bytes --]

#!/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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-09  2:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 16:50 Default object format for new repositories in Git v3 Adam Dinwoodie
2026-11-06 20:46 ` brian m. carlson
2026-11-08  1:16 ` [PATCH] setup: default hash algo to GIT_HASH_DEFAULT brian m. carlson
2026-11-08  4:42   ` Junio C Hamano
2026-11-08 14:38     ` brian m. carlson
2026-11-08 18:22   ` Junio C Hamano
2026-11-09  2:21     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox