statusMatrix() does not work correctly when there is a symlink that targets an ignored directory
Bug description
When there is a symlink that targets an ignored directory (such as node_modules), statusMatrix() would list files within the ignored directory as "new". This is different from git status --porcelain=v1 when these files are not listed.
Steps to reproduce
- Clone https://github.com/KSXGitHub/isomorphic-git-issue-incorrect-file-listing-for-symlink.git
- Run
npm installandnpm test
You will see that the files "within" symlink-to-ignored-directory are listed by isomorphic-git but not by native git.
Hi! I'd love to take a look at this issue and contribute a fix.
From reading through the description, my understanding is that statusMatrix() currently follows symlinks even when those symlinks point to directories that are in .gitignore. Native git status correctly ignores such symlinks, so isomorphic-git should match that behavior.
My plan:
- Reproduce the issue using the linked test repo
- Trace the
statusMatrix()file walking logic to find where symlink targets are being followed without checking.gitignore - Add a check to resolve symlink targets and skip them if the resolved path falls under an ignored directory
- Add a regression test to confirm the fix
Could someone please assign this to me or confirm it's still available? Thanks!
@minutechreview this project doesn't use assignments. You can work on this issue, but remember to add unit tests.
:tada: This issue has been resolved in version 1.38.10 :tada:
The release is available on:
Your semantic-release bot :package::rocket: