Re: [PATCH v2 01/13] pack-objects: extract should_attempt_deltas()
- From
Taylor Blau <me@ttaylorr.com>
- Date
- May 2, 2025, 22:48 UTC
- Message-ID
- <aBVL16rCzFZGjw89@nand.local>
- In-Reply-To
- <57c1cc20de0c80b84ad11a6546763826fe4b1a09.1742829770.git.gitgitgadget@gmail.com>
On Mon, Mar 24, 2025 at 03:22:37PM +0000, Derrick Stolee via GitGitGadget wrote:
Show 21 quoted lines
> @@ -3226,33 +3256,11 @@ static void prepare_pack(int window, int depth)
> for (i = 0; i < to_pack.nr_objects; i++) {
> struct object_entry *entry = to_pack.objects + i;
>
> - if (DELTA(entry))
> - /* This happens if we decided to reuse existing
> - * delta from a pack. "reuse_delta &&" is implied.
> - */
> - continue;
> -
> - if (!entry->type_valid ||
> - oe_size_less_than(&to_pack, entry, 50))
> + if (!should_attempt_deltas(entry))
> continue;
>
> - if (entry->no_try_delta)
> - continue;
> -
> - if (!entry->preferred_base) {
> + if (!entry->preferred_base)
> nr_deltas++;OK, this part didn't move since nr_deltas is local to prepare_pack(). The transformation looks equivalent to me, with the only minor difference being an inconsequential one. Before, we would increment nr_deltas if oe_type() failed, but now we don't. This doesn't matter since the failure mode is die(), so I think this is all OK.
Thanks, Taylor