Subject: Re: [PATCH v3 08/28] shallow.c: add mark_new_shallow_refs()

From: Junio C Hamano <[email-masked]>
Date: Tue, 26 Nov 2013 14:20:21 -0800

Duy Nguyen <[email-masked]> writes:

> On Tue, Nov 26, 2013 at 5:20 AM, Junio C Hamano <[email-masked]> wrote:
>> Hmph.  the use of ->util field in this patch feels that it was
>> something commit-slab data structure was invented to solve.
>
> Good stuff! Thanks.
>
>>> +             if (c->util == NULL)
>>> +                     c->util = bitmap;
>>> +             else {
>>> +                     /*
>>> +                      * Deliberately leak a lot in commit->util
>>> +                      * because there can be many pointers to the
>>> +                      * same bitmap. Probably should allocate in a
>>> +                      * pool and free the whole pool at the end.
>>> +                      */
>>
>> ... or perhaps make the bitmap into
>>
>>         struct {
>>                 int refcnt;
>>                 uint32_t bits[FLEX_ARRAY];
>>         }
>>
>> and refcnt them?
>
> I still prefer memory pools so I just need to do a few free() than
> walking through all the commits again and refcnt-- or free() them.

Fair enough.

> Sorry to break the patches this way and lose the overall call flow.
> It's just too big to put all into one patch. 13/28 is the one that put
> the pieces together but basically
>
>  1. receive the remote's .git/shallow
>  2. call remote_reachable_shallow_points() to exclude our shallow commits
>  3. get the pack and install it (or unpack it)
>  4. call this function to determine what new ref needs new shallow
> commits from the result of #2

Thanks for a roadmap.  Will find time to re-read the thing with it.