Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core/file/fileSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ const createBaseGlobbyOptions = (
absolute: false,
dot: true,
followSymbolicLinks: false,
// Force case-sensitive pattern matching regardless of OS filesystem case sensitivity.
// Without this, on macOS (HFS+/APFS case-insensitive), the default ignore pattern
// `build/**` would incorrectly exclude Pants BUILD files.
caseSensitiveMatch: true,
});

export const getIgnoreFilePatterns = async (config: RepomixConfigMerged): Promise<string[]> => {
Expand Down
25 changes: 25 additions & 0 deletions tests/core/file/fileSearch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ node_modules
absolute: false,
dot: true,
followSymbolicLinks: false,
caseSensitiveMatch: true,
}),
);
});
Expand Down Expand Up @@ -943,6 +944,7 @@ node_modules
absolute: false,
dot: true,
followSymbolicLinks: false,
caseSensitiveMatch: true,
});

// Each call should have either onlyFiles or onlyDirectories, but not both
Expand All @@ -954,6 +956,29 @@ node_modules
}
}
});
test('should not exclude uppercase BUILD files when build/** is in ignore patterns', async () => {
const mockConfig = createMockConfig({
include: ['**/*'],
ignore: {
useGitignore: false,
useDefaultPatterns: false,
customPatterns: ['build/**'],
},
});

// Globby with caseSensitiveMatch: true should NOT exclude BUILD files
vi.mocked(globby).mockResolvedValue(['src/BUILD', 'BUILD']);

const result = await searchFiles('/mock/root', mockConfig);

expect(result.filePaths).toContain('src/BUILD');
expect(result.filePaths).toContain('BUILD');
expect(globby).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({ caseSensitiveMatch: true }),
);
});


test('should respect gitignore config consistently across all functions', async () => {
const mockConfigWithoutGitignore = createMockConfig({
Expand Down