A recursive-ish index structure (as opposed to flat-ish structure, which is
used by git... It turns out that it's hard to efficiently read a flat index
with our internal data structures -- we need to turn the flat index into a
recursive Tree object, which is rather expensive...). As a bonus, we can
also efficiently implement subtree queries this way (cf. readIndex).

See readIndex. This version also gives a map from paths to items, so the
extra per-item data can be used (hash and mtime) directly. The map is in a
form of IORef, since the data is not available until the tree is unfolded.

Read an index and build up a Tree object from it, referring to current
working directory. Any parts of the index that are out of date are updated
in-place. The result is always an up-to-date index. Also, the Tree is stubby
and only the pieces of the index that are unfolded will be actually updated!
To implement a subtree query, you can use Tree.filter and then unfold the
result. Otherwise just unfold the whole tree to avoid unexpected problems.