# git init still creates SHA-1 repositories in Git v3 builds; carlson posts fix

_Builds with WITH_BREAKING_CHANGES=1 did not default to SHA-256, which affects v3 preparation work such as Nixpkgs._

Section: Bugs. Edition of 2026-11-23. 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, testing Git built with WITH_BREAKING_CHANGES=1 for Git v3 and Nixpkgs, found that `git init` still creates SHA-1 repositories rather than SHA-256. He reproduced this at v2.56.0, next and main.

brian m. carlson described problems in the hash algorithm selection code. Because of a bug, the code never considered GIT_HASH_DEFAULT as a default for `git init`, and when the config file names no algorithm, the repository is assumed to be SHA-1. A second problem is that if init.defaultObjectFormat selects an algorithm and a repository is re-initialized, the algorithm is changed, which he said is not desired.

His fix restructures the code. An algorithm chosen on the command line is taken as what the user wanted, and the other sources apply only otherwise.

Junio C Hamano, after reading the previous round fairly thoroughly, said the changes relative to it all look good. Patrick Steinhardt also took part in the thread. The excerpts do not say whether the series has been merged.
