Get the next reference
pointer in which to store the reference
the iterator
0, GIT_ITEROVER if there are no more; or an error code