status: fix handling of filenames with special prefixes

Fix libgit2/libgit2sharp#379
Split UTF-16 and UTF-8 buffer sizes for win32

Also fixed up call-sites to use the correct buffer sizes, especially
when converting to utf-8.
Add rename from rewrites to status

In git_diff_paired_foreach, temporarily resort the
index->workdir diff list by index path so that we can
track a rename in the workdir from head->index->workdir.
Add status test for long paths
Don't use win32-only macro in test code
Add long-file-name branch to test repo
Add checkout test for long file name
Add typedefs for win32 utf-8 and utf-16 buffers

...and normalize the signatures of the two conversion functions.
Rename git_win_str_utf* to git_win32_path_utf*
Discriminate path-specific and general UTF-X conversions
Fixes to safely reading the index

Avoid wrapping around extension size when reading, avoid walking off
the end of the buffer when reading names.
git_strndup fix when OOM
config: allow empty string as value

`git_config_set_string(config, "config.section", "")` fails when
escaping the value.

The buffer in `escape_value` is allocated without NULL-termination. And
in case of empty string 0 is passed for buffer size in `git_buf_grow`.

`git_buf_detach` returns NULL when the allocated size is 0 and that
leads to an error return in `GITERR_CHECK_ALLOC` called after
`escape_value`

The change in `config_file.c` was suggested by Russell Belfer <rb@github.com>
Merge pull request #1771 from nvloff/write_empty_config_value

config: allow setting  empty string as value
Merge pull request #1462 from yorah/fix/libgit2sharp-issue-379

status: fix handling of filenames with special prefixes
Merge pull request #1764 from ethomson/status_renames_from_rewrites

Add rename from rewrites to status
Revert PR #1462 and provide alternative fix

This rolls back the changes to fnmatch parsing from commit
2e40a60e847d6c128af23e24ea7a8efebd2427da except for the tests
that were added.  Instead this adds couple of new flags that can
be passed in when attempting to parse an fnmatch pattern.  Also,
this changes the pathspec match logic to special case matching a
filename with a '!' prefix against a negative pattern.

This fixes the build.
Match against file with leading ! was too broad
Merge pull request #1773 from arrbee/fix-fnmatch-prefix

Revert PR #1462 and provide alternative fix
Improve building ignore file lists

The routines to push and pop ignore files while traversing a
directory had some issues. In particular, setting up the initial
list would sometimes push an ignore file before it ought to be
applied if the starting path was a directory containing an ignore
file. Also, the pop function was not always matching the right
part of the path and would fail to pop ignores from the list in
some cases.

This adds some tests that exercise a particular problematic case
and then fixes the problems that I could find related to this.

At some point, I'd like to isolate this ignore rule management
code and rewrite it, but that's a larger project and right now,
I'll opt to just try to fix the broken behaviors.