Subject: Re: [PATCH v2 08/10] sparse-index: complete partial expansion

From: Junio C Hamano <[email-masked]>
Date: Mon, 23 May 2022 11:01:54 -0700

Derrick Stolee <[email-masked]> writes:

> As I went to remove these from sparse-index.c, I found another that
> exists, but for good reason. See 8a96b9d0a (sparse-index: use
> WRITE_TREE_MISSING_OK, 2021-09-08), which explains that that instance
> needs the flag because it could be used during 'git add'.

Hmph, re-reading that explanation, it appears to me that it is
working around a lack of another option that could be useful in such
a situation, namely, "update the cache tree, and if a tree object is
missing then create one locally; do not bother asking any promisor
remote".  I am reasonably sure that back when I invented missing-ok
there wasn't any such thing as "promisor remote" or "lazy fetch",
and it sounds like those who added "promissor remote" broke the
cache-tree subsystem by introducing calls to fetch from elsewhere?

How does a normal "new object creation" codepath work when promisor
remotes exist?  Does write_object_file() first ask if any promisor
remote have that object and fetch before creating one locally?  That
sounds absurd (i.e. if we have data to create locally why ask others
if they have one already?).  Why should cache-tree behave any
differently?

All of the above are mere observations on changes that have nothing
to do with the change in this series, but cache_tree_update()
knowing about promisor remotes feels serious breakage to me.

> It still isn't necessary in the instances being added here, so I will
> remove them.

OK.