libgit2/libgit2 — pull request #984 by arrbee (2012-10-15 20:01:39+00:00)
Title: Fix single file ignores

The APIs that check if a single file is ignored were not matching the behavior of core git. To test if a file is ignored, it turns out that you have to walk the path down to the file making sure that it is not contained within any earlier ignored directories. This fixes that. Also, the single file status API was sometimes reporting a file as missing when it was really just being ignored. This fixes that, too.

As I started to write this fix, I thought maybe I would need to change the behavior of fnmatch, so this starts with a commit that makes us always use the internal implementation of fnmatch instead of relying on the platform one. I didn't end up making any significant changes to fnmatch, but I kept the commit because I like the idea of using a common fnmatch everywhere.

While I was at it, I found a published DOS attack against the fnmatch implementation that we are using, so I incorporated the suggested fix into the code.