Make commits work from an index.

It's horrible and messy but it works.