Re: [PATCH] diff: avoid segfault with freed entries
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 30, 2025, 04:38 UTC
- Message-ID
- <xmqqtsx8h9dl.fsf@gitster.g>
- In-Reply-To
- <pull.2027.git.1767044697712.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
> The more elaborate explanation is that within diffcore_std(), we may > skip the initial prefetch due to the output format (--name-only in the > test) and go straight to diffcore_skip_stat_unmatch().
That's very interesting. We have code to fetch on-demand when it turns out that the initial prefetch shouldn't have been skipped and we need contents, so in that sense, the condition to skip the initial prefetch does not have to be precise, but we may want to see if we can have a single helper function that exactly tells us if we need to look at the contents or not. I think we had a few changes that made the definition of "diff status is based on contents" in the past few releases, not for the purpose of this prefetch skipping but to set the exit status.