feat(cp): -P option, plus better handling of symlinks#421
Merged
Conversation
3f79e04 to
4fd9b58
Compare
src/cp.js
Outdated
| } | ||
| var srcStat = fs.statSync(src); | ||
| if (srcStat.isDirectory()) { | ||
| if ((!options.noFollowsymlink) && srcStat.isDirectory()) { |
Contributor
There was a problem hiding this comment.
Really nitty nitpick: The parens are redundant.
Contributor
|
One tiny nit, otherwise looks good. Also, could you rebase this? |
4fd9b58 to
d7e15e0
Compare
d7e15e0 to
225f4a9
Compare
Member
Author
I think the new squash-merge takes care of that, right? |
Contributor
|
@nfischer: Alas, it does not 😢. |
Member
Author
|
Oh, where does it put the one PR commit then if not on top of master? |
Contributor
|
@nfischer: It gives you two options:
|
Member
Author
|
Hmm ok. Does this look good now? |
Contributor
|
LGTM! |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #413
Ok, so this wound up being a bigger PR than I anticipated. I originally wanted to implement the
-Poption forcp(), but I realized that ShellJS didn't have very good semantics for handling links. So this PR fixes a variety of bugs surrounding behavior of links.rm('badlink')used to not work, now it doescp('link', 'dest')will follow the linkcp('-R', 'link', 'dest')will not follow the link (regardless of whether it points to a directory or not)cp('-P', 'link', 'dest')will of course not follow the link (regardless of whether or not-Ris used)touch('badlink')creates the file it points to (astouchshould)mkdir('badlink')outputs an error message instead of crashing