-
Notifications
You must be signed in to change notification settings - Fork 787
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
copier: handle globbing with "**" path components #5688
Conversation
5634cf4
to
b46edf0
Compare
4b4af3f
to
a2db852
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, nalind The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
// will be concatenated. | ||
func extendedGlob(pattern string) (matches []string, err error) { | ||
subdirectories := func(dir string) []string { | ||
var subdirectories []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is difficult to read, since the function and the variable have the same name. Would have been better if they were different.
copier/copier.go
Outdated
if len(expanded) > 1 { | ||
patterns = append(append(patterns[:i], expanded...), patterns[i+1:]...) | ||
} else { | ||
i++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use break
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't know that patterns[i+1]
(if we're not at the end of the slice) doesn't need to be expanded.
Handle glob patterns with "**" path components by expanding "**" to the set of subdirectories and calling filepath.Glob() on the results. Signed-off-by: Nalin Dahyabhai <[email protected]>
/lgtm |
fb40f69
into
containers:main
What type of PR is this?
/kind feature
What this PR does / why we need it:
Handle glob patterns with "**" path components by expanding "**" to the set of subdirectories and calling filepath.Glob() on the results.
How to verify it
New unit test!
New conformance tests!
Which issue(s) this PR fixes:
None
Special notes for your reviewer:
Does this PR introduce a user-facing change?