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

Re: When should we release Git 3.0?

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Oct 1, 2025, 22:42 UTC
Message-ID
<aN2uRCbajBhZT08V@fruit.crustytoothpaste.net>
In-Reply-To
<xmqqecrm1hs1.fsf@gitster.g>
On 2025-10-01 at 20:36:14, Junio C Hamano wrote:
Show 5 quoted lines
> What is the recommended workflow if you have unpublished work,
> written back in your private SHA-1 clone of a project, meant to be
> submit someday to your project, that used to use SHA-1 but has
> migrated to SHA-256?  Convert locally your repository to SHA-256
> primary with SHA-1 compat and then push to them?

We don't have support to add an algorithm to an existing repository (although that is a desired feature). If that existed, you could add SHA-256 as a compatibility algorithm to your SHA-1 repository and push, or in any interoperability scenario, you could create a SHA-1 main remote with SHA-256 compatibility, push your changes there, and then push from there to the server.

The interoperability work requires that the client support the server's main algorithm for pushes. This is because with protocol v2, the client gets a capability advertisement with supported algorithms and can choose one for the operation. With protocol v0, the server sends capabilities as a read-only (GET) operation along with the refs and doesn't allow the algorithm to be chosen, so it's impossible to get a ref advertisement in anything but the main algorithm. Since protocol v2 doesn't support pushes, we can only push things in the server's main algorithm.

For the avoidance of doubt, I have no intention of adding support for protocol v2 for pushes. That would be a nice feature and it would allow lifting that restriction, but I also have a responsibility to myself to not explode the scope of this project more than it already has.

Show 11 quoted lines
> Presumably the server side _has_ already done most of the conversion
> work so, provided if (and this is a huge if) we assume that the
> conversion done on the server side is trustable, we should be able
> to _clone_ from the server in SHA-256 primary SHA-1 compat mode, and
> push your unpublished changes from your SHA-1 private repository
> into this clone using SHA-1 protocol (i.e. no conversion to the
> original repository)?  And upon accepting such a push, the receiving
> repository (which is still a local clone of the project, but the one
> you recently made and is aware of SHA-256 world) would now have your
> unpublished work in SHA-256 (with SHA-1 compat) objects and everybody
> is happy?

We always use only one algorithm in the protocol except when we need to map shallows, objects missing in a partial clone, or submodules, in which case we offer a mapping of those objects only. The mapping is always otherwise done on the client side if the client supports both algorithms.

You can create a SHA-256/SHA-1 clone from the server (right now via initializing a SHA-256 repo, adding SHA-1 manually, and then fetching) and _pull_ your changes from your SHA-1 repo, though. (Pushing from SHA-1 into a SHA-256/SHA-1 clone doesn't work as I mentioned above.) You could then push to the SHA-256 server.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Junio C Hamano
Message 33 of 33 in “When should we release Git 3.0?”
  1. brian m. carlsonSep 30, 2025
  2. Luca MilanesioOct 1, 2025
  3. Taylor BlauOct 1, 2025
  4. rsbecker@nexbridge.comOct 1, 2025
  5. Taylor BlauOct 8, 2025
  6. rsbecker@nexbridge.comOct 8, 2025
  7. Patrick SteinhardtOct 2, 2025
  8. Junio C HamanoOct 2, 2025
  9. Michal SuchánekOct 2, 2025
  10. Patrick SteinhardtOct 7, 2025
  11. Michal SuchánekOct 7, 2025
  12. Patrick SteinhardtOct 7, 2025
  13. Michal SuchánekOct 7, 2025
  14. Junio C HamanoOct 7, 2025
  15. Michal SuchánekOct 7, 2025
  16. SZEDER GáborOct 8, 2025
  17. Patrick SteinhardtOct 9, 2025
  18. Ben KnobleOct 2, 2025
  19. Patrick SteinhardtOct 7, 2025
  20. rsbecker@nexbridge.comOct 7, 2025
  21. Taylor BlauOct 8, 2025
  22. Patrick SteinhardtOct 9, 2025
  23. brian m. carlsonOct 16, 2025
  24. Taylor BlauOct 8, 2025
  25. brian m. carlsonOct 16, 2025
  26. brian m. carlsonOct 2, 2025
  27. Taylor BlauOct 1, 2025
  28. Michal SuchánekOct 1, 2025
  29. brian m. carlsonOct 1, 2025
  30. Michal SuchánekOct 2, 2025
  31. Michal SuchánekOct 2, 2025
  32. Junio C HamanoOct 1, 2025
  33. brian m. carlsonOct 1, 2025

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.