Get the Index file of a Git repository
This is a cheap operation; the index is only opened on the first call, and subsequent calls only retrieve the previous pointer.
Pointer where to store the index
a repository object
0 on success; error code if the index could not be opened