isomorphic-git icon indicating copy to clipboard operation
isomorphic-git copied to clipboard

statusMatrix() does not work correctly when there is a symlink that targets an ignored directory

Open KSXGitHub opened this issue 6 years ago • 3 comments

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

  1. Clone https://github.com/KSXGitHub/isomorphic-git-issue-incorrect-file-listing-for-symlink.git
  2. Run npm install and npm test

You will see that the files "within" symlink-to-ignored-directory are listed by isomorphic-git but not by native git.

KSXGitHub avatar Aug 30 '20 05:08 KSXGitHub

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:

  1. Reproduce the issue using the linked test repo
  2. Trace the statusMatrix() file walking logic to find where symlink targets are being followed without checking .gitignore
  3. Add a check to resolve symlink targets and skip them if the resolved path falls under an ignored directory
  4. Add a regression test to confirm the fix

Could someone please assign this to me or confirm it's still available? Thanks!

minutechreview avatar Jul 20 '26 15:07 minutechreview

@minutechreview this project doesn't use assignments. You can work on this issue, but remember to add unit tests.

jcubic avatar Jul 20 '26 19:07 jcubic

:tada: This issue has been resolved in version 1.38.10 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

jcubic avatar Jul 21 '26 17:07 jcubic