# Re: git: how the pack-objects.c find the object's delta

1 messages from 2013-03-18 to 2013-03-18. Participants: Duy Nguyen.
Thread: https://gitlist.dev/t/33211

## Duy Nguyen, 2013-03-18 00:54

Subject: Re: git: how the pack-objects.c find the object's delta
Message-ID: <CACsJy8C6pVTUYvU9xkNchfKBXNzT8nMuM+ggD_FQXtGwNU59wA@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8C6pVTUYvU9xkNchfKBXNzT8nMuM%2BggD_FQXtGwNU59wA%40mail.gmail.com
In-Reply-To: <tencent_0A91BD9B7F2294EF42EFC942@qq.com>

```
Hi,

I can't say from a first glance. Maybe git@vger can help?

On Sun, Mar 17, 2013 at 10:08 PM, 方栋 <fangdong@pipul.org> wrote:
> hello
>
> i don't understand this:
> src in builtin/pack-objects.c  find_deltas() function, line 1800:
>
>
> static void find_deltas(struct object_entry **list, unsigned *list_size,
>             int window, int depth, unsigned *processed)
> {
>         ......
>
>         /*
>          * Move the best delta base up in the window, after the
>          * currently deltified object, to keep it longer.  It will
>          * be the first base object to be attempted next.
>          */
>         if (entry->delta) {
>             struct unpacked swap = array[best_base];
>             int dist = (window + idx - best_base) % window;
>             int dst = best_base;
>             while (dist--) {
>                 int src = (dst + 1) % window;
>                 array[dst] = array[src];
>                 dst = src;
>             }
>             array[dst] = swap;
>         }
>         ......
> }
>
> what this code block use for?
>
> thx
>
>
>
>
> ------------------
> 祝好
> --方（tyut）
>



-- 
Duy

```
