config: don't allow passing NULL as a value to set

Passing NULL is non-sensical. The error message leaves to be desired,
though, as it leaks internal implementation details. Catch it at the
`git_config_set_string` level and set an appropriate error message.
Implement global/system file search paths

The goal of this work is to expose the search logic for "global",
"system", and "xdg" files through the git_libgit2_opts() interface.

Behind the scenes, I changed the logic for finding files to have a
notion of a git_strarray that represents a search path and to store
a separate search path for each of the three tiers of config file.
For each tier, I implemented a function to initialize it to default
values (generally based on environment variables), and then general
interfaces to get it, set it, reset it, and prepend new directories
to it.

Next, I exposed these interfaces through the git_libgit2_opts
interface, reusing the GIT_CONFIG_LEVEL_SYSTEM, etc., constants
for the user to control which search path they were modifying.
There are alternative designs for the opts interface / argument
ordering, so I'm putting this phase out for discussion.

Additionally, I ended up doing a little bit of clean up regarding
attr.h and attr_file.h, adding a new attrcache.h so the other two
files wouldn't have to be included in so many places.
Adds an option to select the CRT link mode ( static or dynamic ).
This is useful when linking libgit2 statically, as the setting must match the linking program's one.
Fix for a cmake bug when using MSVC + Win64 + static libraries
(see http://public.kitware.com/Bug/view.php?id=11240)
Several warnings detected by static code analyzer fixed

Implicit type conversion argument of function to size_t type
Suspicious sequence of types castings: size_t -> int -> size_t
Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)'
Unsigned type is never < 0
Merge pull request #1418 from QbProg/qb/cmake-msvc

MSVC cmake improvements
Merge pull request #1080 from carlosmn/config-set-null

Failing config related test
Merge pull request #1420 from KindDragon/static-code-analyzer-warnings

Several warnings detected by static code analyzer fixed
Switch search paths to classic delimited strings

This switches the APIs for setting and getting the global/system
search paths from using git_strarray to using a simple string with
GIT_PATH_LIST_SEPARATOR delimited paths, just as the environment
PATH variable would contain.  This makes it simpler to get and set
the value.

I also added code to expand "$PATH" when setting a new value to
embed the old value of the path.  This means that I no longer
require separate actions to PREPEND to the value.
Fixes and cleanups

Get rid of some dead code, tighten things up a bit, and fix a bug
with core::env test.
Merge pull request #1417 from arrbee/opts-for-paths

Implement opts interface for global/system file search paths
Three submodule status bug fixes

1. Fix sort order problem with submodules where "mod" was sorting
   after "mod-plus" because they were being sorted as "mod/" and
   "mod-plus/".  This involved pushing the "contains a .git entry"
   test significantly lower in the stack.
2. Reinstate behavior that a directory which contains a .git entry
   will be treated as a submodule during iteration even if it is
   not yet added to the .gitmodules.
3. Now that any directory containing .git is reported as submodule,
   we have to be more careful checking for GIT_EEXISTS when we
   do a submodule lookup, because that is the error code that is
   returned by git_submodule_lookup when you try to look up a
   directory containing .git that has no record in gitmodules or
   the index.
clone: fix param comment
Merge pull request #1423 from arrbee/submodule-status-errors

Three submodule status bug fixes