fix(core): Preserve escaped characters in gitignore patterns (#11171)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
Eric Rahm
2025-10-20 10:03:22 -07:00
committed by GitHub
parent d52ec522f1
commit 518a9ca314
2 changed files with 23 additions and 6 deletions

View File

@@ -234,4 +234,20 @@ src/*.tmp
);
});
});
describe('Escaped Characters', () => {
beforeEach(async () => {
await setupGitRepo();
});
it('should correctly handle escaped characters in .gitignore', async () => {
await createTestFile('.gitignore', '\\#foo\n\\!bar');
// Create files with special characters in names
await createTestFile('bla/#foo', 'content');
await createTestFile('bla/!bar', 'content');
// These should be ignored based on the escaped patterns
expect(parser.isIgnored('bla/#foo')).toBe(true);
expect(parser.isIgnored('bla/!bar')).toBe(true);
});
});
});