in line 2607 we're just returning -1 in case of error.
Here we're returning the exact error code (ret) we get from libgit2.
I don't think this is necessary and w/o it we could shorten the code.