Re: safe.directory: preliminary clean-up
- From
Jeff King <peff@peff.net>
- Date
- Jul 30, 2024, 20:13 UTC
- Message-ID
- <20240730201347.GC567852@coredump.intra.peff.net>
- In-Reply-To
- <xmqq5xsmdarv.fsf_-_@gitster.g>
On Tue, Jul 30, 2024 at 10:56:04AM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> One wrong assumption was that the function might yield NULL when > there is no interpolation. This led to the use of an extra "check" > variable, conditionally holding either the interpolated or the > original string. The assumption was with us since 8959555c > (setup_git_directory(): add an owner check for the top-level > directory, 2022-03-02) originally introduced the safe.directory > feature. > > Another wrong assumption was that the function might yield the same > pointer as the input when there is no interpolation. This led to a > conditional free'ing of the interpolated copy, that the conditional > never skipped, as we always received an allocated string.
Yup. Good eyes on seeing that second one. Both look correct to me from double-checking git_config_pathname(), and the patch itself looks good.
-Peff