Get the last error data and clear it.
This copies the last error into the given git_error
struct
and returns 0 if the copy was successful, leaving the error
cleared as if giterr_clear
had been called.
If there was no existing error in the library, -1 will be returned
and the contents of cpy
will be left unmodified.