This was another area where I just fell back to whatever libgit2 had in it's documentation.

@arrbee's suggestion looks pretty legit to me.