Hook up Windows compat fnmatch() for Solaris

Since Solaris does not support some of the same flags as glibc fnmatch(),
we just use the implementation we have for Windows.

Now that it's no longer a windows-specific thing, I moved it into compat/
instead of win32/
Add cache busting to attribute cache

This makes the git attributes and git ignores cache check
stat information before using the file contents from the
cache.  For cached files from the index, it checks the SHA
of the file instead.  This should reduce the need to ever
call `git_attr_cache_flush()` in most situations.

This commit also fixes the `git_status_should_ignore` API
to use the libgit2 standard parameter ordering.
Fixed mode on clar
Fix rmdir() usage on Solaris

On Solaris, rmdir() throws EEXIST if the folder is not empty, so just add
one more case to check for that, alongside ENOTEMPTY.
Fix comment typo in common.h
Use -fvisibility=hidden in GCC builds
Fix readdir_r() usage for Solaris

On Solaris, struct dirent is defined differently than Linux. The field
containing the path name is of size 0, rather than NAME_MAX. So, we need to
use a properly sized buffer on Solaris to avoid a stack overflow.

Also fix some DIR* leaks on cleanup.
Handle duplicate objects from different backends in git_odb_read_prefix().
Add a test to verify FILENAME_MAX

Since we now rely on it (at least under Solaris), I figured we probably
want to make sure it's accurate. The new test makes sure that creating a
file with a name of length FILENAME_MAX+1 fails.
Merge pull request #694 from nulltoken/topic/mergebase-test-coverage

mergebase: enhance test code coverage
Merge pull request #689 from scunz/visibility-gcc

Use -fvisibility=hidden in GCC builds
Add missing GIT_EXTERN declarations
Merge pull request #682 from arrbee/attribute-cache-buster

Attribute cache buster
Merge pull request #681 from scottjg/solaris-fixes

Fix build/runtime issues on Solaris
Merge pull request #671 from nulltoken/topic/blob_create_fromdisk

Add git_blob_create_fromdisk()
Specifiy dllimport to MSVC if we're not building libgit2.dll

Building a "shared object" (DLL) in Windows includes 2 steps:

- specify __declspec(dllexport)
  when building the library itself. MSVC will disallow itself from
  optimizing these symbols out and reference them in the PE's
  Exports-Table.
  Further, a static link library will be generated. This library
  contains the symbols which are exported via the declsepc above.
  The __declspec(dllexport) becomes part of the symbol-signature
  (like parameter types in C++ are 'mangled' into the symbol name,
  the export specifier is mingled with the name)

- specify __declspec(dllimport)
  when using the library. This again mingles the declspec into the
  name and declares the function / variable with external linkage.

cmake automatically adds -Dgit2_EXPORTS to the compiler arguments
when compiling the libgit2 project.
The 'git2' is the name specified via PROJECT() in CMakeLists.txt.
Merge pull request #688 from hanwen/master

See issue https://github.com/libgit2/libgit2/issues/680
Merge pull request #692 from nulltoken/fix/delete-branch_ENOTFOUND

branch: make git_branch_delete() return GIT_ENOTFOUND when the branch doesn't exist
Merge pull request #693 from nulltoken/topic/enhance_branch_move_test_coverage

branch: cover with test that moving a non existing branch returns ENOTFOUND
notes: add git_notes_foreach()