Matches path against the Git pattern.
Each method returns the furthest matched position, or -1 if not matched at all.