Skip to content

Commit

Permalink
fix(file): Fix issue with Windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
yamadashy committed Mar 8, 2025
1 parent 855e9a9 commit 0c8fbb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/file/fileSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export const getIgnorePatterns = async (rootDir: string, config: RepomixConfigMe

// Add patterns from .git/info/exclude if useGitignore is enabled
if (config.ignore.useGitignore) {
const excludeFilePath = path.join(rootDir, '.git/info/exclude');
const excludeFilePath = path.join(rootDir, '.git', 'info', 'exclude');

try {
const excludeFileContent = await fs.readFile(excludeFilePath, 'utf8');
Expand Down
4 changes: 3 additions & 1 deletion tests/core/file/fileSearch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ temp-files/
`;

vi.mocked(fs.readFile).mockImplementation(async (filePath) => {
if (filePath.toString().endsWith('.git/info/exclude')) {
// Use path.join to create platform-specific path for testing
const excludePath = path.join('.git', 'info', 'exclude');
if (filePath.toString().endsWith(excludePath)) {
return mockExcludeContent;
}
return '';
Expand Down

0 comments on commit 0c8fbb0

Please sign in to comment.