Skip to content

Modified glob pattern. Fixes #666#676

Merged
nfischer merged 1 commit intoshelljs:masterfrom
frandiox:master
Mar 1, 2017
Merged

Modified glob pattern. Fixes #666#676
nfischer merged 1 commit intoshelljs:masterfrom
frandiox:master

Conversation

@frandiox
Copy link
Copy Markdown
Contributor

Rebase of #669

This PR continues #665 and fixes #666.

From node-glob repo:

Note that symlinked directories are not crawled as part of a **, though their contents may match against subsequent portions of the pattern. This prevents infinite loops and duplicates and the like.

Therefore, the current pattern (/**/*) takes the first level of files inside symlinked directories. This PR changes it to /** which does not follow symlinks.

Now both ls and find only show the symlink directory as a single entry. ls -RL follows it.

@frandiox frandiox mentioned this pull request Feb 28, 2017
Copy link
Copy Markdown
Member

@nfischer nfischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my inline comment

glob.sync(p + globPatternRecursive, { dot: options.all, follow: options.link })
.forEach(function (item) {
pushFile(item, path.relative(p, item));
if (path.relative(p, item)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment explaining that this is because the glob pattern returns the directory itself? Otherwise, LGTM

@frandiox
Copy link
Copy Markdown
Contributor Author

@nfischer Comment added 👍

Copy link
Copy Markdown
Member

@nfischer nfischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frandiox thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Difference between bash ls -R and ShellJS ls -R with symlinks

2 participants