init-db.c: honor case on partly case sensitive fs

Most case-insensitive filesystems are at least partially case-
sensitive.  In these filesystems (such as HFS+ on OSX) you can
name a file Filename.txt, then rename the file to FileName.txt.
That file will be accessible by both filenames, but the case is
otherwise honored.  We don't want to have git ignore case on these
partially case-sensitive filesystem implementations.

This change adds an additional check in init-db.c before
automatically setting core.ignorecase to true.

This fixes a problem where if you import an hg repositoray, using
git-remote-hg, on two OSX systems, one with a case-sensitive fs and
the other with case-insensitive fs, the sha1 commit id's of the
repositories diverge on commits where a file was renamed, but only
the case in the filename changes (for example renaming
Filename.cpp -> FileName.cpp).

The alternative solutions are
* to set ignore_case to 0 in fast-import.c at runtime
* explicitly use strcmp, rather than strcmp_icase (also in
  fast-import.c)
* completely rework ignorecase into something that can handle more
  options (true, false, sometimes, maybe, partially, etc...)

Signed-off-by: Reuben Hawkins <reubenhwk@gmail.com>
init-db.c: factor out probe_case_sensitivity func

create_default_files was getting a bit long and indented.  This
particular bit of code got long enough to be its own function.

Signed-off-by: Reuben Hawkins <reubenhwk@gmail.com>
fast-import: delete first, add/modify later

When doing a fast-import on a case-insensitive filesystem, the fast-import
must ensure files are deleted before the other operations.  For example...

M 100644 :1 FileName.txt
D Filename.txt

...in a case sensitive filesystem will rename Filename.txt -> FileName.txt.
On a case insensitive filesystem, however, both files (or rather the only
file) will be deleted.

To properly rename a file, delete the old file first, then recreate the
file with the new name.  IOW, process the above list in this order.

D Filename.txt
M 100644 :1 FileName.txt

Signed-off-by: Reuben Hawkins <reubenhwk@gmail.com>