Subject: Re: [PATCH v2 01/13] pack-objects: extract should_attempt_deltas()

From: Taylor Blau <[email-masked]>
Date: Fri, 2 May 2025 18:48:55 -0400

On Mon, Mar 24, 2025 at 03:22:37PM +0000, Derrick Stolee via GitGitGadget wrote:
> @@ -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