Maybe @ethomson  can correct me but I think I was incorrect in putting the check there, his example method above does not do a similar check and this is now reflected in the new version of the method. I'll go over the git_merge method in libgit2 to see if it can return GIT_ENOTFOUND however (if no one knows off the top of their heads).