Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow symlinks #57

Merged
merged 1 commit into from
Feb 21, 2015
Merged

Follow symlinks #57

merged 1 commit into from
Feb 21, 2015

Conversation

valeriangalliat
Copy link
Contributor

* Removed `getStats` function.
* Added a `resolveSymlinks` function that exposes a `stat` property on
  file object as a side effect (making `getStats` obsolete).
* Added tests.
* Fixes #39.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.86%) to 96.62% when pulling a4ea945 on valeriangalliat:symlinks into 041de1b on wearefractal:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.86%) to 96.62% when pulling a4ea945 on valeriangalliat:symlinks into 041de1b on wearefractal:master.

@yocontra
Copy link
Member

Should this be the default behavior or behind a flag?

Also code coverage decreased from 100%

@valeriangalliat
Copy link
Contributor Author

Should this be the default behavior or behind a flag?

I'd prefer to leave this decision to someone that knows vinyl-fs better than me. 😄

Also code coverage decreased from 100%

Before:

if (stat) {
  file.stat = stat;
}
cb(err, file);

After:

if (err) { // not covered
  return cb(err);
}
file.stat = stat;
cb(null, file);

That's roughly the kind of changes I had to make when switching from getStats to resolveSymlinks, because while the first format allows to increase code coverage without having to explicitely test the error case, it makes the code less readable, mostly when you have nested calls like this.

I have even no idea what I have to pass to vfs.src to make fs.lstat and path.realpath "return" an error… if I pass an unexisting file, it will be handled at the glob level and will never reach the resolveSymlinks function. Any idea?

@yocontra
Copy link
Member

Hmm not really sure how to test those. I guess you would have to mock the fs module and have it return errors and make sure they bubble up. Seems like overkill though IMO - thanks for the PR

yocontra pushed a commit that referenced this pull request Feb 21, 2015
@yocontra yocontra merged commit 9104b8d into gulpjs:master Feb 21, 2015
@yocontra
Copy link
Member

Will be published as a part of the 4.0 release when it is ready. 4.0 = master branch right now

phated pushed a commit that referenced this pull request Dec 5, 2017
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.

Symlinked directories cause EISDIR error from vinyl-fs.src()
3 participants