Re: [PATCH 08/11] pack-objects: create pack v4 tables
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Sep 9, 2013, 10:40 UTC
- Message-ID
- <CACsJy8DbMnr9Y8NyGTNd6r8hSg3zbgaLa1h-e1X7FFVHHahwpg@mail.gmail.com>
- In-Reply-To
- <1378652660-6731-9-git-send-email-pclouds@gmail.com>
On Sun, Sep 8, 2013 at 10:04 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 17 quoted lines
> +static void prepare_sha1_table(void)
> +{
> + unsigned i;
> + /*
> + * This table includes SHA-1s that may not be present in the
> + * pack. One of the use of such SHA-1 is for completing thin
> + * packs, where index-pack does not need to add SHA-1 to the
> + * table at completion time.
> + */
> + v4.all_objs = xmalloc(nr_objects * sizeof(*v4.all_objs));
> + v4.all_objs_nr = nr_objects;
> + for (i = 0; i < nr_objects; i++)
> + v4.all_objs[i] = objects[i].idx;
> + qsort(v4.all_objs, nr_objects, sizeof(*v4.all_objs),
> + sha1_idx_sort);
> +}
> +fwiw this is wrong. Even in the non-thin pack case, pack-objects could write multiple packs to disk and we need different sha-1 table for each one. The situation is worse for thin pack because not all preferred_base entries end up a real dependency in the final pack. I'm working on it..
-- Duy