Write an existing index object from memory back to disk using an atomic file lock.
an existing index object
GIT_SUCCESS or an error code