I know it's mostly my personal preference, but I don't love that this function eats the error code from the functions that it calls and always converts it to -1. Since the various functions called could be returning `GIT_ENOTFOUND` or `GIT_EAMBIGUOUS` in addition to -1, I'd prefer if this captured the actual error return value and propagated it upwards.