# Fix proposed for git init ignoring the default hash in breaking-changes builds

_Builds made with WITH_BREAKING_CHANGES=1 still create SHA-1 repositories, and brian m. carlson has posted a restructuring of the hash-selection code._

Section: Bugs. Edition of 2026-11-25. Written by an AI editor from the thread "Default object format for new repositories in Git v3" (24 messages): https://gitlist.dev/t/66793

Adam Dinwoodie, who was testing Git v3 behaviour for Nixpkgs, reported that `git init` in a build with `WITH_BREAKING_CHANGES=1` still creates SHA-1 repositories rather than SHA-256. He confirmed the behaviour at v2.56.0, on next and on main.

brian m. carlson replied with a patch that describes two problems in the current selection code. First, because of a bug, `git init` has never considered GIT_HASH_DEFAULT. When the config file names no algorithm, the code assumes the repository is SHA-1.

Second, if init.defaultObjectFormat selects an algorithm and a repository is re-initialized, the hash algorithm changes. carlson calls this very much not desired.

The patch restructures the code so that an algorithm given on the command line is taken as what the user wanted. The other sources are consulted only under conditions that the excerpt cuts off.

Junio C Hamano and Patrick Steinhardt also took part in the thread, but the excerpts do not show their positions on the fix. Whether the patch is accepted as posted is not yet visible.
