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

Re: force deterministic trees on git push - exact sort-order of filenames

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 15, 2021, 18:03 UTC
Message-ID
<xmqq1r4m6u84.fsf@gitster.g>
In-Reply-To
<CAGiEHCtdjA+cVXjN43NPbSZfrDtr-kDtPMN4x_VTGSJuPZ8bcg@mail.gmail.com>
milan hauth <milahu@gmail.com> writes:
> fact: the sort-order of filenames in a tree is not strictly regulated
Untrue, sorry.

The rule is "a tree entry that describes a tree object sorts as if its pathname component has a trailing slash '/'". All your sample trees should satisify that rule (or the implementation of Git that created such a tree is broken).

In hindsight, if we used the collation order that puts '/' before all other bytes when sorting the index entries and the tree entries, it would have made a lot of implemenentation details clean and easier to work with, but that would have been feasible in early 2005, and not now.

Previous: René ScharfeNext: milan hauth
Message 3 of 6 in “force deterministic trees on git push - exact sort-order of filenames”
  1. milan hauthOct 15, 2021
  2. René ScharfeOct 15, 2021
  3. Junio C HamanoOct 15, 2021
  4. milan hauthOct 15, 2021
  5. Ævar Arnfjörð BjarmasonOct 17, 2021
  6. Junio C HamanoOct 18, 2021

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.