Skip to content

Commit 7b6fe8e

Browse files
committed
[kensai] force posix glob semantics in gitignore matching
On Windows picomatch auto-enables windows mode and converts backslashes in patterns to path separators. Gitignore \-escapes (escaped trailing space, literal backslash) compiled into patterns that never match anything. windows:false keeps backslashes as escape characters; patterns and matched paths are POSIX on all platforms.
1 parent e8db70e commit 7b6fe8e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • claude/kensai/mcp/review/src/repofs/git/gitignore

claude/kensai/mcp/review/src/repofs/git/gitignore/pattern.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,15 @@ function normalizeCharClasses(pattern: string): string {
109109
}
110110

111111
// Gitignore globs match dotfiles and have no brace expansion or extglob syntax.
112-
const PICOMATCH_OPTIONS: picomatch.PicomatchOptions = { dot: true, nobrace: true, noextglob: true };
112+
// windows:false keeps backslashes as escape characters on all platforms — picomatch's
113+
// Windows auto-detection would convert them to path separators, breaking \-escapes.
114+
// Patterns and matched paths are always POSIX here.
115+
const PICOMATCH_OPTIONS: picomatch.PicomatchOptions = {
116+
dot: true,
117+
nobrace: true,
118+
noextglob: true,
119+
windows: false,
120+
};
113121

114122
function compileMatcher(isPath: boolean, line: string, dir: string): picomatch.Matcher | null {
115123
line = normalizeCharClasses(line);

0 commit comments

Comments
 (0)