read-cache: split-index mode

This split-index mode is designed to keep write cost proportional to
the number of changes the user has made, not the size of the work
tree. (Read cost is another matter, to be dealt separately.)

This mode stores index info in a pair of $GIT_DIR/index and
$GIT_DIR/sharedindex.<SHA-1>. sharedindex is large and unchanged over
time while "index" is smaller and updated often. Format details are in
index-format.txt, although not everything is implemented in this
patch.

Shared indexes are not automatically removed, because it's clear if
the shared index is needed by any (temporary) indexes by just looking
at it. After a while you'll collect stale shared indexes. The good
news is one shared index is useable for long, until $GIT_DIR/index
becomes too big and sluggish that the new shared index must be
created.
read-cache: mark new entries for split index

Make sure entry addition does not lead to merging index.ext back to
index. We don't need to explicitly keep track of new entries.
ce_shared() would return false on them.
read-cache: save deleted entries in split index

Entries that belong to the base index should not be freed. Mark
CE_REMOVE to track them.
read-cache: mark updated entries for split index

The large part of this patch just follows CE_ENTRY_CHANGED
marks. replace_index_entry() is updated to update
split_index->base->cache[] as well so base->cache[] does not reference
to a freed entry.
split-index: the writing part

prepare_to_write_split_index() does the major work, classifying
deleted, updated and added entries. Deleted and updated entries are
marked in bitmaps. Updated and added entries are stored as the main
cache in $GIT_DIR/index. The remaining information is stored in "link"
extension. Note that added/replaced entries are kept sorted. This may
help speed up patching at load time.

An observation is, deleting an entry, then adding it back is recorded
as "entry X is deleted, entry X is added", not "entry X is replaced".
This is simpler, with small overhead: a replaced entry is stored
without its path, a new entry is store with its path.
split-index: the reading part

The procedure is simple enough, and the fact that index.ext strictly
follows index format, should make it relatively easy for other
implementations to read the split index (writing it, on the other
hand, depends on implementation details, but they can always merge
back to single index)

CE_REMOVE'd entries are removed here because only parts of the code
base (unpack_trees in fact) test this bit when they look for the
presence of an entry. Leaving them may confuse the code ignores this
bit and expects to see a real entry.
split-index: do not invalidate cache-tree at read time
split-index: strip pathname of on-disk replaced entries

We know the positions of replaced entries via the replace bitmap in
"link" extension, so the "name" path does not have to be stored (it's
still in the base index). With this, we also have away to
differentiate additions vs replacements at load time to catch broken
writers.
update-index: new options to enable/disable split index mode

If you have a large work tree but only make changes in a subset, then
$GIT_DIR/index's size should be stable after a while. If you change
branches that touch something else, $GIT_DIR/index's size may grow
large that it becomes as slow as the unified index. Do --split-index
again occasionally to force all changes back to the shared index and
keep $GIT_DIR/index small.
read-tree: force split-index mode off on --index-output

Just a (paranoid?) safety measure..
t1700: new tests for split-index mode
read-cache: force split index mode with GIT_TEST_SPLIT_INDEX

This could be used to run the whole test suite with split indexes
t2104: make sure split index mode is off for the version test

Version tests only make sense when all entries are in the same file,
so we can see if version is downgraded to 2 if 3 is not required.
read-tree: note about dropping split-index mode or index version
fixme
unpack-trees fixme
Add TIME() macro for measuring how long a block is executed

Convenient macro to measure how long a code block takes. Support
nested timing. _Not_ meant to be actually used in official code.
TIME()