Use Git Split index to speed up write operations

SPLIT INDEX

This mode is designed for repositories with very large indexes, and aims at reducing the time it takes to repeatedly write these indexes.

In this mode, the index is split into two files, $GIT_DIR/index and $GIT_DIR/sharedindex.. Changes are accumulated in $GIT_DIR/index, the split index, while the shared index file contains all index entries and stays unchanged.

All changes in the split index are pushed back to the shared index file when the number of entries in the split index reaches a level specified by the splitIndex.maxPercentChange config variable (see git-config[1]).

Each time a new shared index file is created, the old shared index files are deleted if their modification time is older than what is specified by the splitIndex.sharedIndexExpire config variable (see git-config[1]).

To avoid deleting a shared index file that is still used, its modification time is updated to the current time everytime a new split index based on the shared index file is either created or read from.

@chriscool Suggested GitLab should leverage Gits split index to speed up write operations. At a glance it seems like a low effort, but high leverage issue and when there's performance capacity I think this issue should be implemented.

Links / references

https://git-scm.com/docs/git-update-index

Edited by James Ramsay (ex-GitLab)