libgit2/libgit2 — pull request #939 by pwkelley (2012-09-17 20:22:30+00:00)
Title: Support for the core.ignorecase flag

This pull request adds support for `core.ignorecase` to libgit2. When appropriate, we use strcasecmp to compare strings instead of strcmp.

When `core.ignorecase` is on, the index object for the repository stores entries in strcasecmp order. This means that index iterators yield results in strcasecmp order as well.

When `core.ignorecase` is on, the workdir iterator returns strcasecmp-ordered results, too.

The tree iterator (representing committed data) always returns data sorted with strcmp. When merge joining results from two iterators that do not sort their output in the same way, the case-sensitive iterator has its results spooled into memory and then sorted before the merge join can occur, using an iterator type called `spoolandsort`. This is a performance penalty, of course.

When we write out the index, and the data stored in the index is in strcasecmp order, we make sure to re-sort it to strcmp order on the way out to disk.

Do people think this approach is the way to go, or are there other opinions about how to attack the problem? Is there anything obvious or non-obvious that I've missed?