Re: [RFC PATCH 3/5] pack-objects: add delta-islands support
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jul 22, 2018, 08:55 UTC
- Message-ID
- <CACsJy8CmJt1Wj=e4TNUUxY-Czn+h0BTVAWLY0ujJhgUKC+Y6yw@mail.gmail.com>
- In-Reply-To
- <20180722054836.28935-4-chriscool@tuxfamily.org>
On Sun, Jul 22, 2018 at 7:52 AM Christian Couder <christian.couder@gmail.com> wrote:
Show 50 quoted lines
> @@ -700,51 +705,58 @@ static struct object_entry **compute_write_order(void)
> */
> for_each_tag_ref(mark_tagged, NULL);
>
> - /*
> - * Give the objects in the original recency order until
> - * we see a tagged tip.
> - */
> + if (use_delta_islands)
> + max_layers = compute_pack_layers(&to_pack);
> +
> ALLOC_ARRAY(wo, to_pack.nr_objects);
> - for (i = wo_end = 0; i < to_pack.nr_objects; i++) {
> - if (objects[i].tagged)
> - break;
> - add_to_write_order(wo, &wo_end, &objects[i]);
> - }
> - last_untagged = i;
> + wo_end = 0;
>
> - /*
> - * Then fill all the tagged tips.
> - */
> - for (; i < to_pack.nr_objects; i++) {
> - if (objects[i].tagged)
> + for (; write_layer < max_layers; ++write_layer) {
> + /*
> + * Give the objects in the original recency order until
> + * we see a tagged tip.
> + */
> + for (i = 0; i < to_pack.nr_objects; i++) {
> + if (objects[i].tagged)
> + break;
> add_to_write_order(wo, &wo_end, &objects[i]);
> - }
> + }
> + last_untagged = i;
>
> - /*
> - * And then all remaining commits and tags.
> - */
> - for (i = last_untagged; i < to_pack.nr_objects; i++) {
> - if (oe_type(&objects[i]) != OBJ_COMMIT &&
> - oe_type(&objects[i]) != OBJ_TAG)
> - continue;
> - add_to_write_order(wo, &wo_end, &objects[i]);
> - }
> + /*
> + * Then fill all the tagged tips.
> + */If we move the code in this loop to a separate function, in a separate patch, first, would it produce a better diff? I think all the indentation change here makes it a bit hard to read.
> + for (; i < to_pack.nr_objects; i++) {
> + if (objects[i].tagged)
> + add_to_write_order(wo, &wo_end, &objects[i]);
> + }-- Duy