Skip to content

feat(glob): use glob module for globbing#359

Merged
ariporad merged 1 commit intomasterfrom
feat-use-glob
Feb 16, 2016
Merged

feat(glob): use glob module for globbing#359
ariporad merged 1 commit intomasterfrom
feat-use-glob

Conversation

@nfischer
Copy link
Copy Markdown
Member

Switch to the glob module to do shell globbing. Fixes a bug in cp() where
hidden files were not copied recursively.

Replaces #275, fixes #225. This is a less-aggressive version of #275 (doesn't modify ls() nearly as much). We should probably add some more glob-related tests though, like file?.txt and things of that sort.

I wrote this up because this will fix one of the bugs I found when writing the ShellString refactor for free.

For what it's worth, this does hurt performance slightly (it takes 16 seconds on average to run npm test instead of 15 seconds), but not by very much. We might be able to get that performance back some other way.

Closes #275, #225.

Switch to the glob module to do shell globbing. Fixes a bug in `cp()` where
hidden files were not copied recursively.
@nfischer nfischer added this to the v0.7.0 milestone Feb 16, 2016
}

sources = common.expand(sources);
sources = common.expand(sources, {dot: true});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't this done in common.wrap?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is still necessary because this is how we turn a directory into a list of its contents. We can probably do an alternative approach, though

@ariporad
Copy link
Copy Markdown
Contributor

LGTM.

I'm going to try to simplify ls a bit, in a separate PR.

@ariporad
Copy link
Copy Markdown
Contributor

Also, @nfischer, thank so much for doing this.

ariporad added a commit that referenced this pull request Feb 16, 2016
feat(glob): use glob module for globbing
@ariporad ariporad merged commit 63e4acc into master Feb 16, 2016
@ariporad ariporad deleted the feat-use-glob branch February 16, 2016 18:50
@nfischer
Copy link
Copy Markdown
Member Author

I agree, we probably can and should trim down on ls's code a bit

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ls globbing does not behave like shell, consider using glob.sync

2 participants