Re: [PATCH 06/14] run_diff_files(): de-mystify the size of combine_diff_path struct
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 10, 2025, 16:40 UTC
- Message-ID
- <xmqqplku8vxb.fsf@gitster.g>
- In-Reply-To
- <20250109084421.GF2748836@coredump.intra.peff.net>
Jeff King <peff@peff.net> 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.
Show 11 quoted lines
> + /*
> + * 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.