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

Re: Are clone/checkout operations deterministic?

From
Stefan Beller <sbeller@google.com>
Date
Jul 17, 2018, 17:58 UTC
Message-ID
<CAGZ79kbJkocY0oe2_efEA3s0dGgR4tnvwpvUTNuJuSSYY=MazQ@mail.gmail.com>
In-Reply-To
<87bmb6chvm.fsf@evledraar.gmail.com>

On Tue, Jul 17, 2018 at 2:48 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 24 quoted lines
>
>
> On Tue, Jul 17 2018, J. Paul Reed wrote:
>
> > Hey Git Devs,
> >
> > I have a bit of an odd question: do git clone/checkout operations have a
> > deterministic ordering?
> >
> > That is: are files guaranteed to be laid down onto disk in any specific
> > (and deterministic) order as a clone and/or checkout operations occurs?
> > (And if so, is it alphabetical order? Depth-first? Something else?)
> >
> > In case the answer is different (and I'd guess that it might be?), I'm
> > mostly interested in the initial clone case... but it would be great to
> > know if, indeed, the answer is different for just-checkouts too.
> >
> > I did some cursory googling, but nothing hopped out at me as an answer to
> > this question.
>
> In practice I think clone, checkout, reset etc. always work in the same
> order you see with `git ls-tree -r --name-only HEAD`, but as far as I
> know this has never been guaranteed or documented, and shouldn't be
> relied on.

The transmission of packfiles is non-deterministic, as the packfiles (which are packed for each clone separately when using core git as a server) are not packed in a deterministic fashion, but in a threaded environment which allows different packing orders.

If you clone from a server that gives you exactly the same pack at all times (assuming the remote repo doesn't change refs), then checkout is currently deterministic in unpacking files to the working tree.

Show 5 quoted lines
>
> E.g. there's probably cases where writing files in parallel is going to
> be faster than writing them sequentially. We don't have such a mode just
> because nobody's written a patch for it, but having that patch would
> break any assumptions of our current order.
+cc Ben who is looking into that, but hasn't spoken up on the mailing list yet.
Previous: Ævar Arnfjörð BjarmasonNext: Duy Nguyen
Message 3 of 5 in “Are clone/checkout operations deterministic?”
  1. J. Paul ReedJul 17, 2018
  2. Ævar Arnfjörð BjarmasonJul 17, 2018
  3. Stefan BellerJul 17, 2018
  4. Duy NguyenJul 17, 2018
  5. Jeff KingJul 17, 2018

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.