On Mon, Jul 25, 2016 at 6:04 PM, Duy Nguyen [off-list ref] wrote:
Hmm.. can you do the counting separately? A shared cache_entry must
have its field "index" greater than zero. By counting the number of
entries whose index is zero (i.e. not shared) against the total number
of real (*) entries, you should have a decent estimate when to split.
Then you can do exactly what "git update-index --no-split-index" and
"git update-index --split-index" sequence does, but in write_index().
It's easier than messing inside split-index.c. If we hit performance
problem, then we can look into changing split-index.c
Yeah, thanks for the suggestion. I will try it.
(*) remember that some entries may be marked CE_REMOVE, which are dead
entries and should not be counted because they will never be written
down on disk.