Make iterators use GIT_ITEROVER & smart advance

1. internal iterators now return `GIT_ITEROVER` when you go past the
   last item in the iteration.
2. `git_iterator_advance` will "advance" to the first item in the
   iteration if it is called immediately after creating the
   iterator, which allows a simpler idiom for basic iteration.
3. if `git_iterator_advance` encounters an error reading data (e.g.
   a missing tree or an unreadable file), it returns the error
   but also attempts to advance past the invalid data to prevent
   an infinite loop.

Updated all tests and internal usage of iterators to account for these new behaviors.