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

Re: [PATCH] delta-islands: revisit trees with new delta marks

From
Derrick Stolee <stolee@gmail.com>
Date
Dec 2, 2026, 19:53 UTC
Message-ID
<6bcf9997-068e-45f3-b737-9df430671de1@gmail.com>
In-Reply-To
<CABPp-BEzyAq6a=uq9-sOsAXFYjHdrga99+QauGxbkkTnOjLaGw@mail.gmail.com>
On 12/2/2026 2:14 PM, Elijah Newren wrote:
Show 12 quoted lines
> On Mon, Nov 30, 2026 at 11:25 AM Derrick Stolee via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>>
>> From: Derrick Stolee <stolee@gmail.com>
>>
>> When exploring the object graph to group objects into delta-islands,
>> some trees and blobs can be visited from one path and then revisited
>> later from another. If those two visits come from objects with different
>> delta marks, then the final mark of the visited object should be the
>> union of those marks. Instead, some cases only have the first marks as
>> we don't reprocess objects marked with SEEN. This gets worse for objects
>> recursively reachable from that object.
...
Show 34 quoted lines
>> It's possible that a true integration of delta islands with path-walk
>> would help here, having the path-walk API compute the delta island marks
>> as we traverse objects in path-based groups. Such an implementation
>> would need to allow for objects to be readded to groups when their delta
>> marks are updated while avoiding multiple emissions of the object from
>> the API. Such a large rework of the delta island computation is avoided
>> for now, as we can reproduce the error with the existing implementation.
> 
> I had difficulty discerning the impact and motivation of the bug you
> are trying to fix, possibly because I only know a little about delta
> islands.  There is one paragraph that states it ("unwanted
> cross-island deltas"), but it reads as history rather than motivation,
> so I missed it at first.  Would it make sense to include the
> motivation near the top of the commit message?  I asked AI, and it
> told me...
> 
> ```
> Delta islands ensure that an object is only stored as a delta against
> a base that is reachable from every island containing the object, so
> that serving any one fork can reuse the on-disk delta instead of
> breaking it and searching for a new one on the fly.
> 
> However, island marks can be incomplete. resolve_tree_islands()
> propagates each tree's marks to its children once, in order of the
> depth at which the tree was first seen. A tree shared at different
> depths (e.g. seen at a/b/ and at x/y/z/) can therefore have its marks
> propagated before a parent from another island adds to them, and the
> late-arriving marks never reach the trees and blobs below it. An
> object missing marks looks like it belongs to fewer islands, so it can
> be deltified against a base that some of its islands cannot reach,
> reintroducing the expensive delta-breaking that islands exist to
> prevent. When the base is the one missing marks, valid deltas are
> instead rejected, making packs larger.
> ```

The base motivation of using delta islands is about avoiding delta expansion and recompression during clones and fetches. By grouping certain tip commits into "reachability categories" (say, refs for each fork in a network) we can avoid having delta bases outside of a typical clone in that "category".

I think [1] is still the best description of this mechanism.
[1] https://blog.github.com/open-source/git/counting-objects/#the-performance-fix

There might also be interesting cases where we say that a "trunk" ref is a certain category and other branches are still reachable but a different island. That could present improvements for --single-branch clones.

Show 5 quoted lines
>> Assisted-by: GPT-6.1 Sol
>> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> 
> I think Signed-off-by is supposed to match the committer; you've used
> two different email addresses.

I noticed this in my submission and have prepared a version already with the fix. I created this in the wrong local directory that had the wrong email configured. Will fix in v2.

Show 33 quoted lines
>> -static void set_island_marks(struct object *obj, struct island_bitmap *marks)
>> +static int set_island_marks(struct object *obj, struct island_bitmap *marks)
>>  {
>>         struct island_bitmap *b;
>>         khiter_t pos;
>> @@ -172,19 +173,23 @@ static void set_island_marks(struct object *obj, struct island_bitmap *marks)
>>                  */
>>                 marks->refcount++;
>>                 kh_value(island_marks, pos) = marks;
>> -               return;
>> +               return 1;
>>         }
>>
>> +       b = kh_value(island_marks, pos);
>> +       if (island_bitmap_is_subset(marks, b))
>> +               return 0;
>> +
>>         /*
>>          * We do have it. Make sure we split any copy-on-write before
>>          * updating.
>>          */
>> -       b = kh_value(island_marks, pos);
>>         if (b->refcount > 1) {
>>                 b->refcount--;
>>                 b = kh_value(island_marks, pos) = island_bitmap_new(b);
>>         }
>>         island_bitmap_or(b, marks);
>> +       return 1;
>>  }
> 
> You're now returning whether obj's marks changed.  Is it worth adding
> a comment above the function mentioning the meaning of the return
> value?

A doc-comment would be good now that this has a nonzero (non-error) return value.

Show 8 quoted lines
>>         if (progress)
>> -               progress_state = start_progress(r, _("Propagating island marks"), nr);
>> +               progress_state = start_progress(r, _("Propagating island marks"), 0);
> 
> We've changed from showing a percentage of completion to just a count
> of trees processed.  Since trees can be reprocessed, there's no
> reasonable total we can give, so this seems like a reasonable change.
> I'm curious if it's worth calling this out in the commit message.
It probably is. Can do.
> Looks good.

Thanks for the review! -Stolee

Previous: Elijah Newren
Message 3 of 3 in “delta-islands: revisit trees with new delta marks”
  1. delta-islands: revisit trees with new delta marksDerrick Stolee via GitGitGadget, Nov 30, 2026
  2. Elijah NewrenDec 2, 2026
  3. Derrick StoleeDec 2, 2026

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.