Subject: Re: [PATCH 06/14] run_diff_files(): de-mystify the size of combine_diff_path struct

From: Junio C Hamano <[email-masked]>
Date: Fri, 10 Jan 2025 08:40:00 -0800

Jeff King <[email-masked]> writes:

> That 4 comes from the earliest code in ea726d02e9 (diff-files: -c and
> --cc options., 2006-01-28).

Thanks.  I have no idea where that hardcoded constant 4 came from,
but I think you are right that 2 would have been the correct number
ea726d02e9 shoudl have used there.

> +			/*
> +			 * Allocate space for two parents, which will come from
> +			 * index stages #2 and #3, if present. Below we'll fill
> +			 * these from (stage - 2).
> +			 */
>  			dpath = combine_diff_path_new(ce->name, ce_namelen(ce),
> -						      wt_mode, null_oid(), 5);
> +						      wt_mode, null_oid(), 2);
>  
>  			while (i < entries) {
>  				struct cache_entry *nce = istate->cache[i];

Perfect.