Re: [PATCH] read-cache: hash the shared index even with index.skipHash
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 27, 2026, 18:44 UTC
- Message-ID
- <xmqqwlpy8681.fsf@gitster.g>
- In-Reply-To
- <5dfa732c.94b8.1a21d16a974.Coremail.bupt_xingxin@163.com>
"Xing Xin" <bupt_xingxin@163.com> writes:
Show 10 quoted lines
>> the most from skipHash? And this patch is breaking the skipHash feature >> for the use case that would benefit the most. And not hashing the index >> files that are not bases would not save as much, since they are expected >> to be much smaller. > > Per write, yes. But what skipHash saves is the hashing done on each > write, and the shared index is only written when it is rewritten, > which the split index is designed to make rare. The frequent writes > are of the small split index, where, as you say, there is little to > save.
That is a very good justification to give in the proposed commit log message and also in the documentation (the behaviour may already be documented in this initial version of the patch, but the reason why the base index ignores the skipHash configuration deserves a mention, too).
Show 12 quoted lines
> - index.skipHash is only ever a configuration variable: it is either > implied by feature.manyFiles, or set as index.skipHash, by the user > or by Scalar, which writes index.skipHash=true into the repository > configuration and resets it on "scalar reconfigure". > > - The split index is enabled by core.splitIndex, which neither a > feature.* setting nor Scalar sets, or by "git update-index > --split-index", which stays in effect while core.splitIndex is > unset. > > When both are set in the configuration, there is no telling which one > the user cares about more.
Isn't that mostly a defect of Scalar? Such a tool that configures the repository without close supervision by the user should be responsible for ensuring that the resulting set of configuration variables gives a coherent story of what the user wants.
But by going the route of your patch, we no longer have to worry about these two features conflicting, so I would say it is a good direction to go.
Thanks.