Fix broken build when MSVC SDL checks is enabled
Merge pull request #1569 from linquize/msvc-sdl

Fix broken build when MSVC SDL checks is enabled
Fix refdb iteration early termination bug

There was a problem found in the Rugged test suite where the
refdb_fs_backend__next function could exit too early in some
very specific hashing patterns for packed refs.  This ports
the Rugged test to libgit2 and then fixes the bug.
Merge pull request #1575 from arrbee/ref-iterator-early-exit

Fix refdb iteration early termination bug
CMake: don't try to use bundled zlib when the system's path is in the cache

The code surrounding zlib bundling did not take into consideration
that ZLIB_LIBRARY gets cached, and assumed that FIND(ZLIB) would
always set ZLIB_FOUND, which does not hold true, as this variable
signifies that we have found the package and had to look at the
system, as its location was not cached.

Only use the bundled sources if the external zlib is neither
newly-found nor cached.