libgit2/libgit2 — pull request #1071 by arrbee (2012-11-15 06:52:43+00:00)
Title: Win32 fixes for diff/checkout/reset

The most recent PR with checkout fixes is broken on Windows. This PR fixes that with three particular fixes:

1. Adds internal `git__strcmp` etc functions for which we can portably use function pointers regardless of cdecl, etc. and uses them in appropriate places.
2. Adds a `p_lstat_posixly` variant on the `p_lstat` call that has POSIX compatible semantics for the use of ENOTDIR on all platforms. I didn't do this everywhere because it is a potentially expensive extra step, but in the few cases where it is needed, it is very helpful.
3. Fixes a reset hard test case that hard-coded some line endings without considering CRLF filters.

For me, this now works great on Windows. There are probably two additional changes that can be addressed at some point, but I don't think they need to be addressed just to merge this PR. They are:

1. The `git__strcasecmp` and `git__strncasecmp` implementations could be rewritten to avoid `tolower()` completely and really achieve platform independence.
2. The diff code can be improved to handle a wider variety of TYPECHANGE scenarios (at a fairly minor cost) which would reduce the overall use of `stat()` and could probably eliminate the extra `stat()` calls from checkout.