       switch part.type {
         case .Name:
           let namePart = part as! GlobMatcherNamePart
+          let bytes = ignoreCase ? Ascii.toLowerCase(namePart.bytes) :
+              namePart.bytes
           if lastType == .Any {
-            m.eatUntilIncludingBytes(namePart.bytes)
+            m.eatUntilIncludingBytes(bytes)
           } else {
-            m.eatBytes(namePart.bytes)
+            m.eatBytes(bytes)
           }
         case .Any: () // Ignore.
         case .One:
           m.next()
         case .Set: ()
-          let setPart = part as! GlobMatcherSetPart
+          var setPart = part as! GlobMatcherSetPart
+          setPart.ignoreCase = ignoreCase
           let table = setPart.makeComparisonTable()
           if setPart.isNegated {
             m.eatOneNotFromTable(table)

          }
        case .Alternative:
          let altPart = part as! GlobMatcherAlternativePart
          if lastType == .Any {
            m.eatUntilIncludingBytesFromList(altPart.bytes)
          } else {
            m.eatBytesFromList(altPart.bytes)
          }
      }
      lastType = part.type

public class Ascii {

  public static func toLowerCase(c: UInt8) -> UInt8 {
    if c >= 65 && c <= 90 {
      return c + 32
    }
    return c
  }
