{"thread":{"id":"33211","subject":"Re: git: how the pack-objects.c find the object's delta","startedAt":"2013-03-18T00:54:34Z","lastAt":"2013-03-18T00:54:34Z","messageCount":1,"participants":["Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"211541","messageId":"CACsJy8C6pVTUYvU9xkNchfKBXNzT8nMuM+ggD_FQXtGwNU59wA@mail.gmail.com","threadId":"33211","inReplyTo":"tencent_0A91BD9B7F2294EF42EFC942@qq.com","subject":"Re: git: how the pack-objects.c find the object's delta","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-03-18T00:54:34Z","receivedAt":"2013-03-18T00:54:34Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Hi,\n\nI can't say from a first glance. Maybe git@vger can help?\n\nOn Sun, Mar 17, 2013 at 10:08 PM, 方栋 <fangdong@pipul.org> wrote:\n> hello\n>\n> i don't understand this:\n> src in builtin/pack-objects.c  find_deltas() function, line 1800:\n>\n>\n> static void find_deltas(struct object_entry **list, unsigned *list_size,\n>             int window, int depth, unsigned *processed)\n> {\n>         ......\n>\n>         /*\n>          * Move the best delta base up in the window, after the\n>          * currently deltified object, to keep it longer.  It will\n>          * be the first base object to be attempted next.\n>          */\n>         if (entry->delta) {\n>             struct unpacked swap = array[best_base];\n>             int dist = (window + idx - best_base) % window;\n>             int dst = best_base;\n>             while (dist--) {\n>                 int src = (dst + 1) % window;\n>                 array[dst] = array[src];\n>                 dst = src;\n>             }\n>             array[dst] = swap;\n>         }\n>         ......\n> }\n>\n> what this code block use for?\n>\n> thx\n>\n>\n>\n>\n> ------------------\n> 祝好\n> --方（tyut）\n>\n\n\n\n-- \nDuy\n"}]}