odb: ignore files in the objects dir

We assume that everything under GIT_DIR/objects/ is a directory. This is
not necessarily the case if some process left a stray file in there.

Check beforehand if we do have a directory and ignore the entry
otherwise.

From libgit2/libgit2sharp#707

---

I'm not sure if we should handle this in `git_path_direach()` instead or if we'd rather handle each individual case, to showcase where we might mistakenly assume what we're dealing with.