emulate core git index writing :(