status: fix handling of filenames with special prefixes

Fix libgit2/libgit2sharp#379
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.
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
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
Merge pull request #1770 from ethomson/index_fuzz

Fixes to safely reading the index