-
Notifications
You must be signed in to change notification settings - Fork 13
Description
I implemented the gitignoreFilter as specified here https://github.com/gliviu/dir-compare?tab=readme-ov-file#implement-gitignore-filter.
However, I started getting errors like:
Error: Path /private/var/folder/a.txt is not in cwd /var/folder
(I shortened the paths for the example)
I discovered that /var/folder is actually a symlink to /private/var/folder. dir-compare turns the symlink into an absolute path, but the GlobbyFilterFunction in gitignoreFilter.ts uses the original symlinked path, not the absolute path, hence the mismatch.
I fixed this for myself by modifying line 26 of gitignoreFilter.ts to use entry.path instead of entry.absolutePath.
https://github.com/gliviu/dir-compare/blob/master/test/extended/gitignoreSupport/gitignoreFilter.ts#L26
You could probably also resolve the absolute paths before calling isGitIgnoredSync.