libgit2 should return an error for these cases anyway, but it wouldn't be bad to check these semantics before you bother calling.