Tracking: Git v3 breaking changes planning
Git v3.0 is coming. As of 28 September 2026, Git upstream have not agreed or committed to any particular date, but spring 2027 has been proposed. This version will introduce a bunch of breaking changes for a lot of the Nixpkgs ecosystem, especially fetchgit, so I'm raising this issue to track what those are and how we're resolving them.
More context and background
Quoting Johannes Schindelin's summary from the Git Contributor Summit:The proposed target is spring 2027: v2.56 in September 2026, v2.98 in December, then v2.99 and v3.0 next spring. The jump in version numbers is intended to signal the approaching breaking changes. March and April were both mentioned; the precise timing is not settled.
There was agreement on releasing v2.99.1 and v3.0 together, differing only in the BREAKING_CHANGES (v3.0 switches them on). That keeps the transition separate from another round of feature development.
The v2.99 version provides an escape hatch if we need it, and it seems likely that someone in the OSS community will keep providing support and patches for v2.99 for at least several years. I expect Nixpkgs will want to provide git2 packages once v3.0 comes out. Nonetheless, I'd prefer us to stay on the fully supported upstream release as much as possible, which means working out how we deal with all the breaking changes.
I'll raise separate issues for separate problems / decision points / &c, and try to keep this top-level issue updated with links and references as appropriate. If you find a problem, feel free to note it here and/or raise a separate issue.
This is my first attempt at running this sort of big project in Nixpkgs. I'm very happy to take hints and suggestions on how to handle things if you think there's anything I'm missing! Feel free to comment here or reach out to me privately.
Critical fixes
- [x] Rust support: #567405 (@winterqt)
- [ ] Build failures:
- [ ]
test.fetchgit+fetchgit { leaveDotGit = true; ... }: #571319 - [x]
python3Packages.dunamai: #571330 / #574373 - [ ]
git-lfs: #571745 / #587608 - [ ]
nix/nix-functional-tests: #571765 - [ ]
python3Packages.dulwich: #574788 - [x]
flutter: #575366 / #575372 - [ ]
python3Packages.uv-dynamic-versioning: #587100 - [ ]
fetchgitwith upstream default hash format change: #589545
- [ ]
- [ ] External dependencies:
- [ ]
nixflakes lack support for git with sha256: NixOS/nix#9980 / NixOS/nix#14526
- [ ]
Optional extras
- [x] Allow building Git v2 packages with breaking features enabled: #567771 (@me-and)
- [x] Ensure Rust support: #572076
- [ ] Support fetching sha256-based Git repositories: #584087
Decisions / planning / philosophy
- [ ] Scheduling and release planning: #570457
- [ ] Identify blocking problems: #571767
- [ ] Handling build failures in
pkgsArocc: #574360 (might move to "critical fixes" or "optional extras" depending on discussions in that issue)
Tagging relevant parties:
- Git maintainers: @wmertens @kashw2 @me-and @philiptaron @zivarah
- fetchgit: ...?
- Others: @winterqt, ...?
@winterqt as well.
iirc git v3 will default new repos to sha-256, now we really need a solution to flakes not supporting sha-256 https://github.com/NixOS/nix/issues/9980
progress:
- waiting on libgit2 v2.0, which will build with sha-256 support by default, the first release candidate is out
- cppnix got the ability to read local sha-256 flakes in 2.35.3
iirc git v3 will default new repos to sha-256, now we really need a solution to flakes not supporting sha-256 NixOS/nix#9980
progress:
waiting on libgit2 v2.0, which will build with sha-256 support by default, the rc was created recently
cppnix should be getting the ability to read local sha-256 flakes in its next release (after 2.35.2)
Good find, thank you! I've added it to the list of sub-issues.
Right now, nix-prefetch-git cannot deal with a git repo using sha256 object format.
This is a quick local-machine-only test to illustrate:
$ nix-shell -p nix-prefetch-git
$ git --version
git version 2.56.0
$ cd /tmp
$ mkdir /tmp/test-git-object-format-sha256
$ cd /tmp/test-git-object-format-sha256
$ git init --object-format=sha256
Initialized empty Git repository in /tmp/test-git-object-format-sha256/.git/
$ touch whatever
$ git add .
$ git commit -m "this is a commit in a git object format sha256 repo"
[main (root-commit) fed38ba] this is a commit in a git object format sha256 repo
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 whatever
$ nix-prefetch-git /tmp/test-git-object-format-sha256/
Initialized empty Git repository in /tmp/nix-shell-3agvijp439ghx7kfb2qc4cvr58/build-top/git-checkout-tmp-SGIVujqq/clone/.git/
fatal: mismatched algorithms: client sha1; server sha256
fatal: couldn't find remote ref fed38ba011c0b15abfab8cac5f759a8dc720230a4c702a72987fc9703504afaf
ERROR: `git fetch' failed.
This might be due to the dumb transfer protocol not supporting shallow fetch or no-tag cloning. Trying with `--tags' and without `--depth=1'...
fatal: mismatched algorithms: client sha1; server sha256
Unable to checkout HEAD from /tmp/test-git-object-format-sha256/.
The most interesting line is fatal: mismatched algorithms: client sha1; server sha256. Looking at the Bash code, nix-prefetch-git first runs git init in a temporary folder, always making a sha1 object format repo because that is the default setting for git v2. It then tries to fetch from the target repo, which of course fails due to the object format mismatch, as the error says.
When git v3 lands, this exact error no longer appears, but (barring any backwards-compatibility mechanisms in upstream Git or in nixpkgs) nix-prefetch-git would git init sha256 object format repos and fail on sha1 object format target repos.
@clakoclast Good shout.
I've just done some testing, and I think there's a bug in upstream Git: I'd have expected git init without explicit config to default to sha256, but it's currently defaulting to sha1. I've reported that upstream. But, at least based on the current behaviour, the concern in your final paragraph doesn't affect us.
I've raised #584087 for the fact that we don't currently support fetching sha256-based repositories. That doesn't block Git v3 being merged into Nixpkgs: based on the current behaviour it seems we'll continue to be able to fetch sha1 repositories using the current code, so nothing that currently works would be broken. However, once v3 lands, I expect we'll start to see sha256-based repositories in the wild, and we'll need to be able to fetch them.