libgit2/libgit2 — pull request #1886 by arrbee (2013-10-01 23:35:47+00:00)
Title: Add support for core.precomposeunicode on Mac

This PR adds support for `core.precomposeunicode` on the Mac platform.

My understanding of the situation is that on HDFS, the Mac canonicalizes filenames to decomposed unicode characters, but will find the file by either the composed or decomposed path (kind of like how it will find files regardless of case). However, on some filesystems (VFAT, SAMBA) MacOS will write files using precomposed unicode pathnames and will match filenames sensitively to the precomposed vs decomposed form, but the `readdir_r` function will still canonicalize returned values to decomposed form. On those filesystems, we want to convert the filenames back to precomposed form before doing any filename comparison.

The current state of this PR is:

* [x] Emulate core Git initialization code to set `core.precomposeunicode`
* [x] Apply config setting to direach usage for iterators
* [x] Apply config setting to direach usage in various backends that might need it
* [ ] Apply config setting in any other places that need it
* [x] Make `git_path_direach` and `git_path_dirload` able to precompose paths on demand using `iconv`
* [ ] Credit Torsten for his core Git work
* [ ] Write tests of low-level iconv functionality
* [ ] Set up test environment that needs precompose functionality
* [ ] Write tests that break if precompose is not working correctly (i.e. filenames with decomposable unicode characters)