AvianFlu / ncp

Asynchronous recursive file copying with Node.js.
MIT License
680 stars 103 forks source link

Add dereference option #48

Closed joliss closed 10 years ago

joliss commented 10 years ago

Hey @AvianFlu, this is the pull request for the "inflate symlinks" option I asked you about on IRC. Unix cp has a --dereference option, so I decided to call it "dereference" rather than "inflateSymlinks" to stick with the established terminology.

I also added tests for the default (dereference=false) symlink handling while I was at it.

When dereference=true, we consider broken symlinks to be errors. (The fs.stat call will return an ENOENT error when it encounters a broken symlink, and we simply don't attempt to handle this.) This mimics the behavior of Unix cp's --dereference.

The first commit is mostly a massive re-indent; all the important stuff is in the second commit.

rwjblue commented 10 years ago

We are using ncp within the Broccoli build tool (it works wonderfully), and are waiting for this PR (and the subsequent release) to pull the trigger on a significant performance fix which involves using symlinks when possible.

@AvianFlu - Would love a review and +1/-1 here.

AvianFlu commented 10 years ago

Awesome, thanks!

joliss commented 10 years ago

Thanks @AvianFlu, for the quick release as well!