Update libgit2 to latest development

This is just the minimum refactoring needed to use the APIs correctly.

Some of the refactoring focused on working with immutable refs (added in libgit2/libgit2#1381), but `GTReference` itself is still mutable, to be fixed at a later date.